feat: 添加 InspiraUI 组件和模式背景功能,更新依赖项
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m0s
/ lint-build-and-check (push) Successful in 4m44s
/ playwright (push) Successful in 3m18s
/ surge (push) Successful in 3m1s

This commit is contained in:
严浩
2025-03-31 14:11:30 +08:00
parent 6e18e0f737
commit 334b2485f5
13 changed files with 1813 additions and 10 deletions

View File

@ -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;