This commit is contained in:
张成
2025-09-10 21:43:36 +08:00
parent d38baa9c5b
commit 5fdee20d45
12 changed files with 281 additions and 152 deletions

View File

@@ -16,7 +16,7 @@ interface GlobalState {
interface GlobalActions {
updateState: (payload: Record<string, any>) => void;
getNavbarHeightInfo: () => void;
getCurrentLocationInfo: () => void;
getCurrentLocationInfo: () => any;
}
// 完整的 Store 类型
type GlobalStore = GlobalState & GlobalActions;
@@ -50,14 +50,13 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
},
// 获取位置信息
getCurrentLocationInfo: () => {
return getCurrentLocation().then((res) => {
set({
getLocationLoading: false,
location: res || {},
});
return res;
getCurrentLocationInfo: async () => {
const res = await getCurrentLocation()
set({
getLocationLoading: false,
location: res || {},
});
return res;
},
// 更新store数据