1
lzhe
2024-06-21 9c094a1fe3e1ae3dadef6433f8401818fe2b8304
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
export default {
    state: {
        keepLiveRoute: [],
        routeKey: null,
        routeShow: true
    },
    mutations: {
        pushKeepLive(state, component){
            if(!state.keepLiveRoute.includes(component)){
                state.keepLiveRoute.push(component)
            }
        },
        removeKeepLive(state, component){
            var index = state.keepLiveRoute.indexOf(component);
            if(index !== -1){
                state.keepLiveRoute.splice(index, 1);
            }
        },
        clearKeepLive(state){
            state.keepLiveRoute = []
        },
        setRouteKey(state, key){
            state.routeKey = key
        },
        setRouteShow(state, key){
            state.routeShow = key
        }
    },
    actions: {
        setRouteKey({ commit }, key) {
            commit('setRouteKey', key);
        }
    }
}