mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 09:09:19 +08:00
fix: ColPage 回写侧栏宽度与收起状态以恢复跨页布局记忆
This commit is contained in:
@@ -56,11 +56,23 @@ export const useColSidebarLayoutStore = defineStore(
|
||||
}
|
||||
|
||||
function setWidth(kind: ColSidebarKind, width: number) {
|
||||
layoutOf(kind).width = clampWidth(width);
|
||||
const next = clampWidth(width);
|
||||
const prev = layoutOf(kind);
|
||||
if (prev.width === next) return;
|
||||
// 整对象替换,确保 pinia persist 能稳定序列化
|
||||
layouts.value = {
|
||||
...layouts.value,
|
||||
[kind]: { ...prev, width: next },
|
||||
};
|
||||
}
|
||||
|
||||
function setCollapsed(kind: ColSidebarKind, collapsed: boolean) {
|
||||
layoutOf(kind).collapsed = collapsed;
|
||||
const prev = layoutOf(kind);
|
||||
if (prev.collapsed === collapsed) return;
|
||||
layouts.value = {
|
||||
...layouts.value,
|
||||
[kind]: { ...prev, collapsed },
|
||||
};
|
||||
}
|
||||
|
||||
function $reset() {
|
||||
|
||||
Reference in New Issue
Block a user