From c12fb3a61dd9703b8ded064a16c4b83087fb05a1 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期三, 23 四月 2025 10:24:06 +0800 Subject: [PATCH] 缓存存入由cookie修改为localStorage --- src/store/modules/app.js | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 3e22d1c..c93f1f8 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,13 +1,11 @@ -import Cookies from 'js-cookie' - const state = { sidebar: { - opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, + opened: localStorage.getItem('sidebarStatus') ? !!+localStorage.getItem('sidebarStatus') : true, withoutAnimation: false, hide: false }, device: 'desktop', - size: Cookies.get('size') || 'medium' + size: localStorage.getItem('size') || 'medium' } const mutations = { @@ -18,13 +16,13 @@ state.sidebar.opened = !state.sidebar.opened state.sidebar.withoutAnimation = false if (state.sidebar.opened) { - Cookies.set('sidebarStatus', 1) + localStorage.setItem('sidebarStatus', 1) } else { - Cookies.set('sidebarStatus', 0) + localStorage.setItem('sidebarStatus', 0) } }, CLOSE_SIDEBAR: (state, withoutAnimation) => { - Cookies.set('sidebarStatus', 0) + localStorage.setItem('sidebarStatus', 0) state.sidebar.opened = false state.sidebar.withoutAnimation = withoutAnimation }, @@ -33,7 +31,7 @@ }, SET_SIZE: (state, size) => { state.size = size - Cookies.set('size', size) + localStorage.setItem('size', size) }, SET_SIDEBAR_HIDE: (state, status) => { state.sidebar.hide = status -- Gitblit v1.9.3