forked from github/dataease
fix(仪表板): 修复移动端PC端反复切换,样式状态未同步问题
This commit is contained in:
parent
a3c7092c0d
commit
80f5d03914
@ -33,6 +33,9 @@ const getComponentStyleDefault = () => {
|
||||
}
|
||||
}
|
||||
const mobileStatusChange = (type, value) => {
|
||||
if (type === 'componentStyleChange') {
|
||||
changeTimes.value++
|
||||
}
|
||||
const iframe = document.querySelector('iframe')
|
||||
if (iframe) {
|
||||
iframe.contentWindow.postMessage(
|
||||
@ -52,7 +55,18 @@ const iframeSrc = computed(() => {
|
||||
: './mobile.html#/panel'
|
||||
})
|
||||
const handleLoad = () => {
|
||||
canvasViewInfoMobile.value = JSON.parse(JSON.stringify(unref(canvasViewInfo)))
|
||||
const mobileViewInfo = JSON.parse(JSON.stringify(unref(canvasViewInfo)))
|
||||
// 移动端初始化话
|
||||
if (!!mobileViewInfo) {
|
||||
Object.keys(mobileViewInfo).forEach(key => {
|
||||
const { customAttrMobile, customStyleMobile } = canvasViewInfo.value[key]
|
||||
mobileViewInfo[key]['customAttr'] =
|
||||
customAttrMobile || canvasViewInfo.value[key]['customAttrMobile']
|
||||
mobileViewInfo[key]['customStyle'] =
|
||||
customStyleMobile || canvasViewInfo.value[key]['customStyleMobile']
|
||||
})
|
||||
}
|
||||
canvasViewInfoMobile.value = mobileViewInfo
|
||||
mobileStatusChange(
|
||||
'panelInit',
|
||||
JSON.parse(
|
||||
@ -61,7 +75,7 @@ const handleLoad = () => {
|
||||
JSON.stringify(unref(componentData.value.filter(ele => !!ele.inMobile)))
|
||||
),
|
||||
canvasStyleData: JSON.parse(JSON.stringify(unref(canvasStyleData))),
|
||||
canvasViewInfo: JSON.parse(JSON.stringify(unref(canvasViewInfo))),
|
||||
canvasViewInfo: mobileViewInfo,
|
||||
dvInfo: JSON.parse(JSON.stringify(unref(dvInfo))),
|
||||
isEmbedded: !!embeddedStore.baseUrl
|
||||
})
|
||||
|
@ -21,12 +21,6 @@ const checkItemPosition = component => {
|
||||
const hanedleMessage = event => {
|
||||
if (event.data.type === 'panelInit') {
|
||||
const { componentData, canvasStyleData, dvInfo, canvasViewInfo, isEmbedded } = event.data.value
|
||||
Object.keys(canvasViewInfo).forEach(viewId => {
|
||||
const viewInfo = canvasViewInfo[viewId]
|
||||
const { customAttrMobile, customStyleMobile } = viewInfo
|
||||
viewInfo.customAttr = customAttrMobile || viewInfo.customAttr
|
||||
viewInfo.customStyle = customStyleMobile || viewInfo.customStyle
|
||||
})
|
||||
componentData.forEach(ele => {
|
||||
const { mx, my, mSizeX, mSizeY, mStyle, mCommonBackground } = ele
|
||||
ele.x = mx
|
||||
|
Loading…
Reference in New Issue
Block a user