2017-08-30 17:42:06 +08:00
|
|
|
import Cookies from 'js-cookie'
|
2017-06-26 13:38:24 +08:00
|
|
|
|
|
|
|
const app = {
|
|
|
|
state: {
|
|
|
|
sidebar: {
|
|
|
|
opened: !+Cookies.get('sidebarStatus')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
TOGGLE_SIDEBAR: state => {
|
|
|
|
if (state.sidebar.opened) {
|
2017-08-30 17:42:06 +08:00
|
|
|
Cookies.set('sidebarStatus', 1)
|
2017-06-26 13:38:24 +08:00
|
|
|
} else {
|
2017-08-30 17:42:06 +08:00
|
|
|
Cookies.set('sidebarStatus', 0)
|
2017-06-26 13:38:24 +08:00
|
|
|
}
|
2017-08-30 17:42:06 +08:00
|
|
|
state.sidebar.opened = !state.sidebar.opened
|
2017-06-26 13:38:24 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
ToggleSideBar: ({ commit }) => {
|
|
|
|
commit('TOGGLE_SIDEBAR')
|
|
|
|
}
|
|
|
|
}
|
2017-08-30 17:42:06 +08:00
|
|
|
}
|
2017-06-26 13:38:24 +08:00
|
|
|
|
2017-08-30 17:42:06 +08:00
|
|
|
export default app
|