添加程序选择
This commit is contained in:
@@ -11,12 +11,20 @@ interface GlobalState {
|
||||
navBarHeight: number;
|
||||
totalHeight: number;
|
||||
};
|
||||
// GuideBar 显示/隐藏状态
|
||||
showGuideBar: boolean;
|
||||
// GuideBar z-index 层级
|
||||
guideBarZIndex: 'low' | 'high';
|
||||
}
|
||||
|
||||
interface GlobalActions {
|
||||
updateState: (payload: Record<string, any>) => void;
|
||||
getNavbarHeightInfo: () => void;
|
||||
getCurrentLocationInfo: () => any;
|
||||
// GuideBar 控制方法
|
||||
setShowGuideBar: (show: boolean) => void;
|
||||
setGuideBarZIndex: (zIndex: 'low' | 'high') => void;
|
||||
toggleGuideBar: () => void;
|
||||
}
|
||||
// 完整的 Store 类型
|
||||
type GlobalStore = GlobalState & GlobalActions;
|
||||
@@ -37,6 +45,10 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
|
||||
totalHeight: 0,
|
||||
},
|
||||
|
||||
// GuideBar 状态
|
||||
showGuideBar: true,
|
||||
guideBarZIndex: 'high',
|
||||
|
||||
// 获取导航栏高度信息
|
||||
getNavbarHeightInfo: () => {
|
||||
const { statusBarHeight, navBarHeight } = getNavbarHeight();
|
||||
@@ -67,6 +79,22 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
|
||||
...(payload || {}),
|
||||
});
|
||||
},
|
||||
|
||||
// GuideBar 控制方法
|
||||
setShowGuideBar: (show: boolean) => {
|
||||
console.log('[Store] setShowGuideBar called with:', show);
|
||||
set({ showGuideBar: show });
|
||||
console.log('[Store] showGuideBar updated to:', show);
|
||||
},
|
||||
|
||||
setGuideBarZIndex: (zIndex: 'low' | 'high') => {
|
||||
set({ guideBarZIndex: zIndex });
|
||||
},
|
||||
|
||||
toggleGuideBar: () => {
|
||||
const { showGuideBar } = get();
|
||||
set({ showGuideBar: !showGuideBar });
|
||||
},
|
||||
}));
|
||||
|
||||
// 导出便捷的 hooks
|
||||
|
||||
Reference in New Issue
Block a user