feat: 添加 InspiraUI 组件和模式背景功能,更新依赖项
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch, type WatchHandle } from 'vue';
|
||||
|
||||
const layoutConfig = reactive({
|
||||
darkTheme: false,
|
||||
@ -23,15 +23,17 @@ const layoutState = reactive({
|
||||
staticMenuDesktopInactive: getStoredMenuState(),
|
||||
staticMenuMobileActive: false,
|
||||
});
|
||||
|
||||
let _watcher: WatchHandle;
|
||||
export function useLayout() {
|
||||
// 监听 staticMenuDesktopInactive 的变化并保存到 localStorage
|
||||
watch(
|
||||
() => layoutState.staticMenuDesktopInactive,
|
||||
(newValue) => {
|
||||
localStorage.setItem('staticMenuDesktopInactive', JSON.stringify(newValue));
|
||||
},
|
||||
);
|
||||
if (!_watcher) {
|
||||
// 监听 staticMenuDesktopInactive 的变化并保存到 localStorage
|
||||
_watcher = watch(
|
||||
() => layoutState.staticMenuDesktopInactive,
|
||||
(newValue) => {
|
||||
localStorage.setItem('staticMenuDesktopInactive', JSON.stringify(newValue));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const setActiveMenuItem = (item: Record<string, never>) => {
|
||||
layoutState.activeMenuItem = item.value || item;
|
||||
|
Reference in New Issue
Block a user