fix(仪表板): 修复tab移出在仪表板可能出现组件重叠问题

This commit is contained in:
wangjiahao 2024-11-05 20:56:22 +08:00
parent af82c59967
commit 6e099a3442
3 changed files with 15 additions and 2 deletions

View File

@ -349,7 +349,7 @@ const coordinates = ref([]) //坐标点集合
let lastTask = undefined
let isOverlay = false //
let moveTime = 200 //
let moveTime = 100 //
const itemMaxY = ref(0)
let itemMaxX = 0
@ -874,6 +874,11 @@ function removeItemById(componentId) {
removeItem(index)
}
})
if (!isMainCanvas(canvasId.value)) {
nextTick(() => {
canvasInit()
})
}
}
}

View File

@ -335,8 +335,9 @@ const componentMoveIn = component => {
component.style.left = 0
component.style.top = 0
tabItem.componentData.push(component)
nextTick(() => {
refInstance.addItemBox(component) //
nextTick(() => {
refInstance.canvasInitImmediately()
})
}
} else {

View File

@ -133,6 +133,10 @@ const handleMouseDown = e => {
}
}
const canvasInitImmediately = () => {
cyGridster.value.canvasInit()
}
const canvasInit = (isFistLoad = true) => {
if (canvasActive.value) {
renderState.value = true
@ -218,6 +222,7 @@ const moveOutFromTab = component => {
componentData: componentData.value
})
addItemBox(component)
canvasInit()
}, 500)
}
@ -272,6 +277,8 @@ watch(
defineExpose({
addItemBox,
canvasInit,
canvasInitImmediately,
getBaseMatrixSize
})
</script>