Blame view

wenjuan/src/store/modules/app.js 1.07 KB
e5b57447   杨鑫   '分包问卷'
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
  import Cookies from 'js-cookie'
  
  const state = {
    sidebar: {
      // opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
      opened: false,
      withoutAnimation: true
    },
    device: 'desktop'
  }
  
  const mutations = {
    TOGGLE_SIDEBAR: state => {
      state.sidebar.opened = !state.sidebar.opened
      // state.sidebar.withoutAnimation = false
      if (state.sidebar.opened) {
        Cookies.set('sidebarStatus', 1)
      } else {
        Cookies.set('sidebarStatus', 0)
      }
    },
    CLOSE_SIDEBAR: (state, withoutAnimation) => {
      Cookies.set('sidebarStatus', 0)
      state.sidebar.opened = false
      // state.sidebar.withoutAnimation = withoutAnimation
    },
    TOGGLE_DEVICE: (state, device) => {
      state.device = device
    }
  }
  
  const actions = {
d64cd58f   wesley88   上传验收小程序
33
    toggleSideBar ({ commit }) {
e5b57447   杨鑫   '分包问卷'
34
35
36
37
38
      commit('TOGGLE_SIDEBAR')
    },
    // closeSideBar({ commit }, { withoutAnimation }) {
    //   commit('CLOSE_SIDEBAR', withoutAnimation)
    // },
d64cd58f   wesley88   上传验收小程序
39
    toggleDevice ({ commit }, device) {
e5b57447   杨鑫   '分包问卷'
40
41
42
43
44
45
46
47
48
49
      commit('TOGGLE_DEVICE', device)
    }
  }
  
  export default {
    namespaced: true,
    state,
    mutations,
    actions
  }