/* * @Author: changjun * @FilePath: /yuan-qingdao-zld-browser/src/views/screen/logic/useGlobalSafeScreen.ts * @Date: 2022-09-07 09:47:53 * @Description: 全局的安全综合态势大屏 hook * @LastEditTime: 2023-09-01 17:43:06 * @LastEditors: 曹文丽 */ import { computed, ref } from 'vue'; import { createGlobalState } from '@vueuse/core'; import { mapMapping } from '../../../assets/map/provinceData'; const mapData = mapMapping(); export const useGlobalSafeScreen = createGlobalState(() => { const currentCity = ref(mapData?.name); // 当前选择的省市 const currentDate = ref(1); // 当前选择的日期 // 1:今日 2:7日 3:30日 4:半年 // 设置当前选择的市 function setCurrentCity(city: string = mapData?.name) { currentCity.value = city; } const handleClickDate = (val: number) => { currentDate.value = val; // currentCity.value = mapData.name; }; return { currentDate, currentCity, handleClickDate, setCurrentCity }; });