Bläddra i källkod

chore: update `responsive-storage`

xiaoxian521 2 år sedan
förälder
incheckning
007bb0124f
3 ändrade filer med 24 tillägg och 38 borttagningar
  1. 1 1
      package.json
  2. 4 8
      pnpm-lock.yaml
  3. 19 29
      src/utils/storage/responsive.ts

+ 1 - 1
package.json

@@ -60,7 +60,7 @@
     "qrcode": "^1.5.0",
     "qs": "^6.10.1",
     "resize-observer-polyfill": "^1.5.1",
-    "responsive-storage": "^1.0.11",
+    "responsive-storage": "^2.0.0",
     "rgb-hex": "^4.0.0",
     "swiper": "^8.1.4",
     "v-contextmenu": "3.0.0",

+ 4 - 8
pnpm-lock.yaml

@@ -80,7 +80,7 @@ specifiers:
   qrcode: ^1.5.0
   qs: ^6.10.1
   resize-observer-polyfill: ^1.5.1
-  responsive-storage: ^1.0.11
+  responsive-storage: ^2.0.0
   rgb-hex: ^4.0.0
   rimraf: 3.0.2
   rollup: ^2.70.1
@@ -151,7 +151,7 @@ dependencies:
   qrcode: 1.5.0
   qs: 6.10.3
   resize-observer-polyfill: 1.5.1
-  responsive-storage: 1.0.11_vue@3.2.37
+  responsive-storage: 2.0.0
   rgb-hex: 4.0.0
   swiper: 8.1.4
   v-contextmenu: 3.0.0_vue@3.2.37
@@ -7360,15 +7360,11 @@ packages:
       supports-preserve-symlinks-flag: 1.0.0
     dev: true
 
-  /responsive-storage/1.0.11_vue@3.2.37:
+  /responsive-storage/2.0.0:
     resolution:
       {
-        integrity: sha512-XY/21b7FKCXwBWGLuxp5KUQOAh8jOTsdfRMz0RVE9P+HhK4oYXKcNESDLxE1mD5MWPg/i+k4SGogro5daMrE9A==
+        integrity: sha512-4pZbTlwDmJAbnZ0B93aQVfTOY58+LYwwQBGPDqAI89NbjnrgVdmqqemmzkfOSGNqFWWnCamq9moWASFk+oC2Fg==
       }
-    peerDependencies:
-      vue: ^3.2.0
-    dependencies:
-      vue: 3.2.37
     dev: false
 
   /restore-cursor/3.1.0:

+ 19 - 29
src/utils/storage/responsive.ts

@@ -3,49 +3,39 @@ import { App } from "vue";
 import Storage from "responsive-storage";
 import { routerArrays } from "/@/layout/types";
 
+const nameSpace = "responsive-";
+
 export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
   const configObj = Object.assign(
     {
       // 国际化 默认中文zh
-      locale: {
-        type: Object,
-        default: Storage.getData(undefined, "locale") ?? {
-          locale: config.Locale ?? "zh"
-        }
+      locale: Storage.getData("locale", nameSpace) ?? {
+        locale: config.Locale ?? "zh"
       },
       // layout模式以及主题
-      layout: {
-        type: Object,
-        default: Storage.getData(undefined, "layout") ?? {
-          layout: config.Layout ?? "vertical",
-          theme: config.Theme ?? "default",
-          darkMode: config.DarkMode ?? false,
-          sidebarStatus: config.SidebarStatus ?? true,
-          epThemeColor: config.EpThemeColor ?? "#409EFF"
-        }
+      layout: Storage.getData("layout", nameSpace) ?? {
+        layout: config.Layout ?? "vertical",
+        theme: config.Theme ?? "default",
+        darkMode: config.DarkMode ?? false,
+        sidebarStatus: config.SidebarStatus ?? true,
+        epThemeColor: config.EpThemeColor ?? "#409EFF"
       },
-      configure: {
-        type: Object,
-        default: Storage.getData(undefined, "configure") ?? {
-          grey: config.Grey ?? false,
-          weak: config.Weak ?? false,
-          hideTabs: config.HideTabs ?? false,
-          showLogo: config.ShowLogo ?? true,
-          showModel: config.ShowModel ?? "smart",
-          multiTagsCache: config.MultiTagsCache ?? false
-        }
+      configure: Storage.getData("configure", nameSpace) ?? {
+        grey: config.Grey ?? false,
+        weak: config.Weak ?? false,
+        hideTabs: config.HideTabs ?? false,
+        showLogo: config.ShowLogo ?? true,
+        showModel: config.ShowModel ?? "smart",
+        multiTagsCache: config.MultiTagsCache ?? false
       }
     },
     config.MultiTagsCache
       ? {
           // 默认显示首页tag
-          tags: {
-            type: Array,
-            default: Storage.getData(undefined, "tags") ?? routerArrays
-          }
+          tags: Storage.getData("tags", nameSpace) ?? routerArrays
         }
       : {}
   );
 
-  app.use(Storage, configObj);
+  app.use(Storage, { nameSpace, memory: configObj });
 };