初始化状态

This commit is contained in:
wzy-warehouse
2026-04-16 09:14:32 +08:00
parent b25cdc2aae
commit b3ba81dfe2
2 changed files with 38 additions and 2 deletions
+2 -2
View File
@@ -20,8 +20,8 @@
import { useMap } from '@/hooks/map/useMap'; import { useMap } from '@/hooks/map/useMap';
onBeforeMount(() => { onBeforeMount(() => {
// 初始化为false // 重置所有状态
useStatusStore().appLoadingCompleted = false; useStatusStore().reset();
// 重置状态 // 重置状态
useLoadingInformationStore().resetStatue(); useLoadingInformationStore().resetStatue();
+36
View File
@@ -79,11 +79,47 @@ export const useStatusStore = defineStore('status', () => {
showReservoir: false, showReservoir: false,
}); });
/**
* 恢复默认值
*/
const reset = () => {
// 应用加载状态重置
appLoadingCompleted.value = false;
// UI 组件显示状态重置
uiComponents.legendShow = true;
uiComponents.disasterChainPointShow = false;
// 地图基础图层显示状态重置
mapLayers.showAdministrativeDivision = true;
mapLayers.hiddenDangerPointShow = true;
mapLayers.riskPointShow = true;
// POI图层显示状态重置
poiLayers.showHospital = false;
poiLayers.showDangerSource = false;
poiLayers.showRefugeeShelter = false;
poiLayers.showFireStation = false;
poiLayers.showReservePoint = false;
poiLayers.showSchool = false;
poiLayers.showPopulationGrid = false;
poiLayers.showSubwayStation = false;
// 基础设施图层显示状态重置
infrastructureLayers.showNetworkSystem = false;
infrastructureLayers.showTrafficRoad = false;
infrastructureLayers.showBridge = false;
infrastructureLayers.showHighway = false;
infrastructureLayers.showMainRoad = false;
infrastructureLayers.showReservoir = false;
};
return { return {
appLoadingCompleted, appLoadingCompleted,
uiComponents, uiComponents,
mapLayers, mapLayers,
poiLayers, poiLayers,
infrastructureLayers, infrastructureLayers,
reset,
}; };
}); });