diff --git a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue index afa589bd54..30626d2f3d 100644 --- a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue +++ b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue @@ -29,29 +29,31 @@ const mobileStatusChange = (type, value) => { } const handleLoad = () => { - mobileLoading.value = false - console.log('dvInfo', JSON.parse(JSON.stringify(unref(dvInfo)))) - - setTimeout(() => { - mobileStatusChange( - 'panelInit', - JSON.parse( - JSON.stringify({ - componentData: JSON.parse(JSON.stringify(unref(componentData))), - canvasStyleData: JSON.parse(JSON.stringify(unref(canvasStyleData))), - canvasViewInfo: JSON.parse(JSON.stringify(unref(canvasViewInfo))), - dvInfo: JSON.parse(JSON.stringify(unref(dvInfo))) - }) - ) + mobileStatusChange( + 'panelInit', + JSON.parse( + JSON.stringify({ + componentData: JSON.parse(JSON.stringify(unref(componentData))), + canvasStyleData: JSON.parse(JSON.stringify(unref(canvasStyleData))), + canvasViewInfo: JSON.parse(JSON.stringify(unref(canvasViewInfo))), + dvInfo: JSON.parse(JSON.stringify(unref(dvInfo))) + }) ) - }, 800) + ) } const componentDataNotInMobile = computed(() => { return componentData.value.filter(ele => !ele.inMobile) }) +const hanedleMessage = event => { + if (event.data.type === 'panelInit') { + mobileLoading.value = false + handleLoad() + } +} onMounted(() => { + window.addEventListener('message', hanedleMessage) dvMainStore.setMobileInPc(true) useEmitt({ name: 'onMobileStatusChange', @@ -63,6 +65,7 @@ onMounted(() => { onBeforeUnmount(() => { dvMainStore.setMobileInPc(false) + window.removeEventListener('message', hanedleMessage) }) const addToMobile = com => { @@ -81,13 +84,7 @@ const addToMobile = com => {
{{ dvInfo.name }}
-