智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/9f/9f13a21e140cc428454cb66d1dd...

33 lines
751 B

function onMessage (pageId, arg) {
pageId = parseInt(pageId)
const page = getCurrentPages(true).find(page => page.$page.id === pageId)
if (!page) {
return
}
if (!page.$page.meta.isNVue) {
const target = page.$vm._$vd.elements.find(target => target.type === 'web-view' && target.events.message)
if (!target) {
return
}
target.dispatchEvent('message', {
type: 'message',
target: Object.create(null),
currentTarget: Object.create(null),
timeStamp: Date.now(),
detail: {
data: [arg]
}
})
}
}
export default function onWebInvokeAppService ({
name,
arg
}, pageIds) {
if (name === 'postMessage') {
onMessage(pageIds[0], arg)
} else {
uni[name](arg)
}
}