app.js
1.03 KB
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
35
36
37
38
39
40
41
42
43
44
45
import Cookies from 'js-cookie'
import { useDark, useToggle } from '@vueuse/core'
const state = {
sidebar: {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
withoutAnimation: false,
},
device: 'desktop',
size: Cookies.get('size') || 'medium',
busininessDesc: undefined,
isDark: useDark(),
}
const actions = {
toggleSideBar() {
this.app.sidebar.opened = !this.app.sidebar.opened
this.app.sidebar.withoutAnimation = false
if (this.app.sidebar.opened) {
Cookies.set('sidebarStatus', 1)
} else {
Cookies.set('sidebarStatus', 0)
}
},
closeSideBar({ withoutAnimation }) {
Cookies.set('sidebarStatus', 0)
this.app.sidebar.opened = false
this.app.sidebar.withoutAnimation = withoutAnimation
},
toggleDevice(device) {
this.app.device = device
},
setSize(size) {
this.app.size = size
Cookies.set('size', size)
},
setBusininessDesc(busininessDesc) {
this.app.busininessDesc = busininessDesc
},
}
export default {
state,
actions,
}