From 64a6a53b42d2565b0427c9c2d956155f37c488aa Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期二, 01 四月 2025 10:33:41 +0800
Subject: [PATCH] 路由菜单渲染逻辑修改,缓存和tag持久化

---
 src/store/index.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/store/index.js b/src/store/index.js
index 382863b..55c2719 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -5,8 +5,8 @@
 const store = new Vuex.Store({
   state: {
     menus: localStorage.getItem('menuList') ? JSON.parse(localStorage.getItem('menuList')) : [],
-    keepAliveList: [],//缓存页面
-    tagList: [],//标签列表
+    keepAliveList: localStorage.getItem('keepAliveList') ? JSON.parse(localStorage.getItem('keepAliveList')) : [],//缓存页面
+    tagList: localStorage.getItem('tagList') ? JSON.parse(localStorage.getItem('tagList')) : [],//标签列表
     isFold: false,//是否折叠
   },
   mutations: {
@@ -15,9 +15,11 @@
     },
     SET_KEEPALIVELIST(state, data) {
       state.keepAliveList = data;
+      localStorage.setItem('keepAliveList', JSON.stringify(data));
     },
     SET_TAGLIST(state, data) {
       state.tagList = data;
+      localStorage.setItem('tagList', JSON.stringify(data));
     },
     SET_ISFOLD(state, data) {
       state.isFold = data;

--
Gitblit v1.7.1