提交 8345b0a4 编写于 作者: fxy060608's avatar fxy060608

fix(app-plus-nvue): postMessage

上级 e85e60a6
......@@ -294,7 +294,8 @@ function initSubNVue (nvue, plus, BroadcastChannel) {
}
}
function initPostMessage (plus) {
function initPostMessage (nvue) {
const plus = nvue.requireModule('plus');
return {
postMessage (data) {
plus.postMessage(data, UNIAPP_SERVICE_NVUE_ID);
......@@ -568,7 +569,7 @@ function initUni (uni, nvue, plus, BroadcastChannel) {
getSubNVueById,
getCurrentSubNVue,
requireNativePlugin: nvue.requireModule
}, initTitleNView(nvue), initPostMessage(plus));
}, initTitleNView(nvue), initPostMessage(nvue));
if (typeof Proxy !== 'undefined') {
return new Proxy({}, {
......
......@@ -30,7 +30,7 @@ export default function initUni (uni, nvue, plus, BroadcastChannel) {
getSubNVueById,
getCurrentSubNVue,
requireNativePlugin: nvue.requireModule
}, initTitleNView(nvue), initPostMessage(plus))
}, initTitleNView(nvue), initPostMessage(nvue))
if (typeof Proxy !== 'undefined') {
return new Proxy({}, {
......
......@@ -2,7 +2,8 @@ import {
UNIAPP_SERVICE_NVUE_ID
} from './util'
export function initPostMessage (plus) {
export function initPostMessage (nvue) {
const plus = nvue.requireModule('plus')
return {
postMessage (data) {
plus.postMessage(data, UNIAPP_SERVICE_NVUE_ID)
......
......@@ -6,7 +6,9 @@ export function initSubNVue (nvue, plus, BroadcastChannel) {
let origin
const onMessageCallbacks = []
const postMessage = nvue.requireModule('plus').postMessage
const onSubNVueMessage = function onSubNVueMessage (data) {
onMessageCallbacks.forEach(callback => callback({
origin,
......@@ -45,7 +47,7 @@ export function initSubNVue (nvue, plus, BroadcastChannel) {
to: isPopupNVue ? hostNVueId : popupNVueId
})
} else {
plus.postMessage({
postMessage({
type: 'UniAppSubNVue',
data: data
}, UNIAPP_SERVICE_NVUE_ID)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册