diff --git a/core/core-frontend/src/views/mobile/panel/index.vue b/core/core-frontend/src/views/mobile/panel/index.vue index 859f25e983..c786100fc2 100644 --- a/core/core-frontend/src/views/mobile/panel/index.vue +++ b/core/core-frontend/src/views/mobile/panel/index.vue @@ -89,7 +89,10 @@ const hanedleMessage = event => { } } -onBeforeMount(() => { +let p = null +const XpackLoaded = () => p(true) +onBeforeMount(async () => { + await new Promise(r => (p = r)) window.top.postMessage({ type: 'panelInit', value: true }, '*') window.addEventListener('message', hanedleMessage) useEmitt({ @@ -106,6 +109,7 @@ const mobileStatusChange = (type, value) => { eventBus.emit('removeMatrixItemById-canvas-main', value) } } + onBeforeUnmount(() => { window.removeEventListener('message', hanedleMessage) }) @@ -115,6 +119,11 @@ onBeforeUnmount(() => {