添加重新加载仪表板网格小部件的功能,以清理 GridStack 内部响应式布局缓存

This commit is contained in:
jxxghp
2026-06-29 22:09:13 +08:00
parent bb5299c812
commit 4492e211bb
+9
View File
@@ -769,6 +769,7 @@ async function exitDashboardLayoutEditing() {
isLayoutEditing.value = false isLayoutEditing.value = false
await nextTick() await nextTick()
await reloadDashboardGridWidgetsFromLayout()
syncDashboardFillContentState() syncDashboardFillContentState()
resizeAutoDashboardItemsToContent() resizeAutoDashboardItemsToContent()
notifyDashboardContentResize() notifyDashboardContentResize()
@@ -1306,6 +1307,14 @@ async function persistCurrentDashboardGridLayout(manualHeightId: string | false
persistDashboardGridLayout(manualHeightId) persistDashboardGridLayout(manualHeightId)
} }
// 清理 GridStack 内部响应式布局缓存,并用当前 Vue 布局状态重新注册已有 DOM 节点。
async function reloadDashboardGridWidgetsFromLayout() {
if (!dashboardGrid.value) return
dashboardGrid.value.removeAll(false, false)
await syncDashboardGrid()
}
watch(isLayoutEditing, value => { watch(isLayoutEditing, value => {
updateDashboardGridEditableState(value) updateDashboardGridEditableState(value)
}) })