fix:移动端点击菜单之后面板不会隐藏
This commit is contained in:
@@ -1,33 +1,31 @@
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
import defaultSettings from '@/settings'
|
||||
const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
sidebar: {
|
||||
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
||||
withoutAnimation: false,
|
||||
// withoutAnimation: false,
|
||||
hide: false
|
||||
},
|
||||
device: 'desktop',
|
||||
size: Cookies.get('size') || 'small',
|
||||
size: Cookies.get('size') || defaultSettings.defaultSize,
|
||||
lang: Cookies.get('lang') || 'zh-cn'
|
||||
}),
|
||||
actions: {
|
||||
toggleSideBar(withoutAnimation) {
|
||||
toggleSideBar() {
|
||||
if (this.sidebar.hide) {
|
||||
return false
|
||||
}
|
||||
this.sidebar.opened = !this.sidebar.opened
|
||||
this.sidebar.withoutAnimation = withoutAnimation
|
||||
if (this.sidebar.opened) {
|
||||
Cookies.set('sidebarStatus', 1)
|
||||
} else {
|
||||
Cookies.set('sidebarStatus', 0)
|
||||
}
|
||||
},
|
||||
closeSideBar(withoutAnimation) {
|
||||
closeSideBar() {
|
||||
Cookies.set('sidebarStatus', 0)
|
||||
this.sidebar.opened = false
|
||||
this.sidebar.withoutAnimation = withoutAnimation
|
||||
},
|
||||
toggleDevice(device) {
|
||||
this.device = device
|
||||
|
||||
Reference in New Issue
Block a user