正在显示
1 个修改的文件
包含
4 行增加
和
5 行删除
| 1 | -import Cookies from 'js-cookie' | ||
| 2 | 1 | ||
| 3 | const app = { | 2 | const app = { |
| 4 | state: { | 3 | state: { |
| 5 | sidebar: { | 4 | sidebar: { |
| 6 | - opened: !+Cookies.get('sidebarStatus'), | 5 | + opened: !+localStorage.getItem('sidebarStatus'), |
| 7 | withoutAnimation: false | 6 | withoutAnimation: false |
| 8 | }, | 7 | }, |
| 9 | device: 'desktop' | 8 | device: 'desktop' |
| ... | @@ -11,14 +10,14 @@ const app = { | ... | @@ -11,14 +10,14 @@ const app = { |
| 11 | mutations: { | 10 | mutations: { |
| 12 | TOGGLE_SIDEBAR: state => { | 11 | TOGGLE_SIDEBAR: state => { |
| 13 | if (state.sidebar.opened) { | 12 | if (state.sidebar.opened) { |
| 14 | - Cookies.set('sidebarStatus', 1) | 13 | + localStorage.setItem('sidebarStatus', 1) |
| 15 | } else { | 14 | } else { |
| 16 | - Cookies.set('sidebarStatus', 0) | 15 | + localStorage.setItem('sidebarStatus', 0) |
| 17 | } | 16 | } |
| 18 | state.sidebar.opened = !state.sidebar.opened | 17 | state.sidebar.opened = !state.sidebar.opened |
| 19 | }, | 18 | }, |
| 20 | CLOSE_SIDEBAR: (state, withoutAnimation) => { | 19 | CLOSE_SIDEBAR: (state, withoutAnimation) => { |
| 21 | - Cookies.set('sidebarStatus', 1) | 20 | + localStorage.setItem('sidebarStatus', 1) |
| 22 | state.sidebar.opened = false | 21 | state.sidebar.opened = false |
| 23 | state.sidebar.withoutAnimation = withoutAnimation | 22 | state.sidebar.withoutAnimation = withoutAnimation |
| 24 | }, | 23 | }, | ... | ... |
-
请 注册 或 登录 后发表评论