Files
xian_vue_new/src/component/rain-earthquake/detail-panels/PopulationGridComponent.vue
T
2026-05-07 13:59:14 +08:00

41 lines
919 B
Vue

<template>
<!-- 加载人口网格 -->
<LoadingGeoserverLayer
:id="`people`"
:layers="`xian:xian_people`"
@provide-layers="provideLayers"
/>
</template>
<script lang="ts" setup>
import { useStatusStore } from '@/stores/useStatusStore.ts';
import type { ImageryLayer } from 'cesium';
import { onMounted, watch } from 'vue';
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
const statusStore = useStatusStore();
// 保存图层引用
let populationLayer: ImageryLayer | null = null;
onMounted(() => {
// 监听显示
watch(
() => statusStore.poiLayers.showPopulationGrid.show,
(newValue: boolean) => {
populationLayer!.show = newValue;
}
);
});
/**
* 提供图层
* @param layer 图层
*/
function provideLayers(layer: ImageryLayer) {
populationLayer = layer;
}
</script>
<style scoped></style>