From be84102dc381d0c1925e477f15a431d6c327c0d6 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Tue, 05 Sep 2023 15:05:41 +0800
Subject: [PATCH] 项目添加中设置中心点功能
---
src/store/map.ts | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/src/store/map.ts b/src/store/map.ts
index cf6b163..0bea697 100644
--- a/src/store/map.ts
+++ b/src/store/map.ts
@@ -1,5 +1,32 @@
-const map = {
- state: {
-
+import { MutationTree } from 'vuex'
+const state = () => ({
+ // 项目中心点设置
+ centerConfig: {
+ // true为开启在地图中获取坐标
+ type: false,
+ latitude: null as number | null,
+ longitude: null as number | null,
+ },
+ // 所有项目中心点
+ pointList: [],
+})
+interface longitude {
+ longitude:number
+ latitude: number
+}
+export type RootStateType = ReturnType<typeof state>
+const mutations: MutationTree<RootStateType> = {
+ // 开启设置地图坐标标识
+ SET_CENTER_CONFIG_TYPE (state, type: boolean) {
+ state.centerConfig.type = type
+ },
+ // 设置经纬度
+ SET_CENTER_CONFIG_LATITUDE (state, data:longitude) {
+ state.centerConfig.longitude = data.longitude
+ state.centerConfig.latitude = data.latitude
}
}
+export default {
+ state,
+ mutations
+}
--
Gitblit v1.9.3