You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.5 KiB
73 lines
1.5 KiB
const state = {
|
|
sidebar: {
|
|
opened: localStorage.getItem('sidebarStatus') ? !!+localStorage.getItem('sidebarStatus') : true,
|
|
withoutAnimation: false
|
|
},
|
|
device: 'desktop',
|
|
size: localStorage.getItem('size') || 'medium',
|
|
loading: false
|
|
}
|
|
|
|
const mutations = {
|
|
TOGGLE_SIDEBAR: state => {
|
|
state.sidebar.opened = !state.sidebar.opened
|
|
state.sidebar.withoutAnimation = false
|
|
if (state.sidebar.opened) {
|
|
localStorage.setItem('sidebarStatus', 1)
|
|
} else {
|
|
localStorage.setItem('sidebarStatus', 0)
|
|
}
|
|
},
|
|
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
localStorage.setItem('sidebarStatus', 0)
|
|
state.sidebar.opened = false
|
|
state.sidebar.withoutAnimation = withoutAnimation
|
|
},
|
|
TOGGLE_DEVICE: (state, device) => {
|
|
state.device = device
|
|
},
|
|
SET_SIZE: (state, size) => {
|
|
state.size = size
|
|
localStorage.setItem('size', size)
|
|
},
|
|
APP_MAIN_LOADING: (state, loading) => {
|
|
state.loading = loading
|
|
}
|
|
}
|
|
|
|
const actions = {
|
|
toggleSideBar({
|
|
commit
|
|
}) {
|
|
commit('TOGGLE_SIDEBAR')
|
|
},
|
|
closeSideBar({
|
|
commit
|
|
}, {
|
|
withoutAnimation
|
|
}) {
|
|
commit('CLOSE_SIDEBAR', withoutAnimation)
|
|
},
|
|
toggleDevice({
|
|
commit
|
|
}, device) {
|
|
commit('TOGGLE_DEVICE', device)
|
|
},
|
|
setSize({
|
|
commit
|
|
}, size) {
|
|
commit('SET_SIZE', size)
|
|
},
|
|
appMainLoading({
|
|
commit
|
|
}, loading) {
|
|
commit('APP_MAIN_LOADING', loading)
|
|
}
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions
|
|
}
|
|
|