lxf 1 year ago
parent
commit
230c6b8231
4 changed files with 11 additions and 13 deletions
  1. 1 1
      .env.prod
  2. 2 2
      package.json
  3. 1 1
      src/main.js
  4. 7 9
      src/store/modules/tagsView.js

+ 1 - 1
.env.production → .env.prod

@@ -2,7 +2,7 @@
 VITE_APP_TITLE = 胜德
 
 # 生产环境配置
-VITE_APP_ENV = 'production'
+VITE_APP_ENV = 'prod'
 
 # 若依管理系统/生产环境
 VITE_APP_BASE_API = '/prod-api'

+ 2 - 2
package.json

@@ -6,7 +6,7 @@
   "license": "MIT",
   "scripts": {
     "dev": "vite",
-    "build:prod": "vite build --mode production && node ./build/build-pro.js",
+    "build:prod": "vite build --mode prod && node ./build/build-pro.js",
     "build:stage": "vite build --mode staging && node ./build/build-pro.js",
     "preview": "vite preview"
   },
@@ -46,7 +46,7 @@
     "moment": "^2.29.4",
     "nprogress": "0.2.0",
     "pinia": "2.0.22",
-    "pinia-plugin-persistedstate": "^3.2.0",
+    "pinia-plugin-persist": "^1.0.0",
     "pubsub-js": "^1.9.4",
     "sortablejs": "^1.15.0",
     "typescript": "^5.0.4",

+ 1 - 1
src/main.js

@@ -28,7 +28,7 @@ import { useDict } from "@/utils/dict";
 
 import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from "@/utils/ruoyi";
 import { createPinia } from "pinia"; //引入pinia
-import piniaPluginPersist from "pinia-plugin-persistedstate"; //引入pinia数据持久化插件
+import piniaPluginPersist from "pinia-plugin-persist"; //引入pinia数据持久化插件
 import VueLazyLoad from 'vue-lazyload'
 
 // 按钮防抖

+ 7 - 9
src/store/modules/tagsView.js

@@ -184,15 +184,13 @@ const useTagsViewStore = defineStore("tags-view_sd", {
     },
   },
   persist: {
-    key: "tags-view_sd",
-    storage: sessionStorage,
-    // enabled: true, //开启数据持久化
-    // strategies: [
-    //   {
-    //     key: "tags-view_sd", //给一个要保存的名称
-    //     storage: sessionStorage, //sessionStorage / localStorage 存储方式
-    //   },
-    // ],
+    enabled: true, //开启数据持久化
+    strategies: [
+      {
+        key: "tags-view_sd", //给一个要保存的名称
+        storage: sessionStorage, //sessionStorage / localStorage 存储方式
+      },
+    ],
   },
 });