xieb
2023-09-13 3667807a7b7418efc090ee3fa6a6b734bc3080bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { MutationTree } from 'vuex'
interface longitude {
  longitude:number
  latitude: number
}
const state = () => ({
  // 项目中心点设置
  centerConfig: {
    // true为开启在地图中获取坐标
    type: false,
    latitude: null as number | null,
    longitude: null as number | null,
  },
  // 项目列表中在地图中展示中心点
  pointList: [] as longitude[] | [],
})
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
  },
  // 设置项目列表中的中心点
  SET_POINT_LIST (state, data: longitude[]) {
    state.pointList = data
  }
}
export default {
  state,
  mutations
}