fix(嵌入式): 嵌入式场景下仪表板切换到移动端无法正常显示

This commit is contained in:
dataeaseShu 2024-05-09 14:40:55 +08:00
parent bc22dfe4f2
commit a321351fe2
2 changed files with 13 additions and 5 deletions

View File

@ -95,7 +95,7 @@ const hanedleMessage = event => {
})
}
if (event.data.type === 'mobileSaveFromMobile') {
if (['mobileSaveFromMobile', 'mobilePatchFromMobile'].includes(event.data.type)) {
componentData.value.forEach(ele => {
const com = event.data.value[ele.id]
if (!!com) {
@ -117,8 +117,14 @@ const hanedleMessage = event => {
}
}
})
}
if (event.data.type === 'mobileSaveFromMobile') {
saveCanvasWithCheckFromMobile()
}
if (event.data.type === 'mobilePatchFromMobile') {
emits('pcMode')
}
}
const saveCanvasWithCheckFromMobile = () => {
@ -175,7 +181,7 @@ const changeTimes = ref(0)
const activeCollapse = ref('com')
const handleBack = () => {
if (!changeTimes.value) {
emits('pcMode')
mobileStatusChange('mobilePatch', undefined)
return
}
ElMessageBox.confirm('当前的更改尚未保存,确定退出吗?', {
@ -184,7 +190,9 @@ const handleBack = () => {
autofocus: false,
showClose: false
}).then(() => {
emits('pcMode')
setTimeout(() => {
mobileStatusChange('mobilePatch', undefined)
}, 100)
})
}

View File

@ -62,10 +62,10 @@ const hanedleMessage = event => {
dvMainStore.setCanvasStyle(event.data.value)
}
if (event.data.type === 'mobileSave') {
if (['mobileSave', 'mobilePatch'].includes(event.data.type)) {
window.parent.postMessage(
{
type: 'mobileSaveFromMobile',
type: `${event.data.type}FromMobile`,
value: dvMainStore.componentData.reduce((pre, next) => {
const { x, y, sizeX, sizeY, id, component } = next
pre[id] = { x, y, sizeX, sizeY, component }