suerprisePlus
2024-08-14 d4a3ca549f8755c2f87442c27217c3be39cab5cc
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
37
38
39
40
import Cookies from 'js-cookie';
import busEvent from '@/utils/busEvent';
const state = {
    layerTree: [],
    defaultLayer: [],
    mapInfo: [],
};
 
const mutations = {
    CHANGE_LAYERTREE: (state, res) => {
        state.layerTree = res;
    },
    CHANGE_DEFAULTLAYER: (state, res) => {
        state.defaultLayer = res;
    },
    CHANGE_MAPINFO: (state, res) => {
        state.mapInfo = res;
        busEvent.$emit('CHANGE_MAPINFO',  state.mapInfo);
    
    },
};
 
const actions = {
    changeLayerTree({ commit }, obj) {
        commit('CHANGE_LAYERTREE', obj);
    },
    changeDefaultLayer({ commit }, obj) {
        commit('CHANGE_DEFAULTLAYER', obj);
    },
    changeMapInfo({ commit }, obj) {
        commit('CHANGE_MAPINFO', obj);
    },
};
 
export default {
    namespaced: true,
    state,
    mutations,
    actions,
};