wr1207
2023-04-17 32e4bad2cff2793052effcd2d59cdd8923702b22
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
export default {
    state :{
        sidebar: {
            opened: true,
            withoutAnimation: false
        },
        device: 'desktop'
    },
    mutations :{
        toggle_device: (state, device) => {
            state.device = device
        },
        toggle_sidebar: state => {
            state.sidebar.opened = !state.sidebar.opened
            state.sidebar.withoutAnimation = false
        },
        close_sidebar: (state, withoutAnimation) => {
            state.sidebar.opened = false
            state.sidebar.withoutAnimation = withoutAnimation
        },
    },
    actions :{
        toggleDevice({ commit }, device) {
            commit('toggle_device', device)
        },
        toggleSideBar({ commit }) {
            commit('toggle_sidebar')
        },
        closeSideBar({ commit }, { withoutAnimation }) {
            commit('close_sidebar', withoutAnimation)
        },
    }
}