Ver Fonte

fix(store): fix type error after pinia version upgrade

vben há 3 anos atrás
pai
commit
e8d6f8851e

+ 11 - 1
.vscode/settings.json

@@ -118,5 +118,15 @@
   "i18n-ally.enabledParsers": ["ts"],
   "i18n-ally.sourceLanguage": "en",
   "i18n-ally.enabledFrameworks": ["vue", "react"],
-  "cSpell.words": ["vben", "windi", "browserslist", "esnext", "antv", "tinymce", "qrcode", "sider"]
+  "cSpell.words": [
+    "vben",
+    "windi",
+    "browserslist",
+    "esnext",
+    "antv",
+    "tinymce",
+    "qrcode",
+    "sider",
+    "pinia"
+  ]
 }

+ 1 - 0
CHANGELOG.zh_CN.md

@@ -30,6 +30,7 @@
 - 修复后台模式下,Iframe 路由错误
 - **PageWrapper** 修复 footer 与全局页脚同时开启时的高度计算问题
 - **Menu** 修复菜单折叠动画抖动问题
+- **Store**修复 pinia 版本升级之后类型错误
 
 ## 2.4.2(2021-06-10)
 

+ 8 - 8
package.json

@@ -35,8 +35,8 @@
   },
   "dependencies": {
     "@iconify/iconify": "^2.0.2",
-    "@logicflow/core": "^0.4.15",
-    "@logicflow/extension": "^0.4.15",
+    "@logicflow/core": "^0.5.0",
+    "@logicflow/extension": "^0.5.0",
     "@vueuse/core": "^5.0.3",
     "@zxcvbn-ts/core": "^0.3.0",
     "ant-design-vue": "2.1.6",
@@ -45,12 +45,12 @@
     "cropperjs": "^1.5.12",
     "crypto-js": "^4.0.0",
     "echarts": "^5.1.2",
-    "intro.js": "^4.0.0",
+    "intro.js": "^4.1.0",
     "lodash-es": "^4.17.21",
     "mockjs": "^1.1.0",
     "nprogress": "^0.2.0",
     "path-to-regexp": "^6.2.0",
-    "pinia": "2.0.0-alpha.13",
+    "pinia": "2.0.0-beta.3",
     "print-js": "^1.6.0",
     "qrcode": "^1.4.4",
     "sortablejs": "^1.13.0",
@@ -66,17 +66,17 @@
   "devDependencies": {
     "@commitlint/cli": "^12.1.4",
     "@commitlint/config-conventional": "^12.1.4",
-    "@iconify/json": "^1.1.357",
+    "@iconify/json": "^1.1.358",
     "@purge-icons/generated": "^0.7.0",
     "@types/codemirror": "^5.60.0",
     "@types/crypto-js": "^4.0.1",
     "@types/fs-extra": "^9.0.11",
-    "@types/inquirer": "^7.3.1",
+    "@types/inquirer": "^7.3.2",
     "@types/intro.js": "^3.0.1",
     "@types/jest": "^26.0.23",
     "@types/lodash-es": "^4.17.4",
     "@types/mockjs": "^1.0.3",
-    "@types/node": "^15.12.2",
+    "@types/node": "^15.12.4",
     "@types/nprogress": "^0.2.0",
     "@types/qrcode": "^1.4.0",
     "@types/qs": "^6.9.6",
@@ -94,7 +94,7 @@
     "conventional-changelog-cli": "^2.1.1",
     "cross-env": "^7.0.3",
     "dotenv": "^10.0.0",
-    "eslint": "^7.28.0",
+    "eslint": "^7.29.0",
     "eslint-config-prettier": "^8.3.0",
     "eslint-define-config": "^1.0.8",
     "eslint-plugin-jest": "^24.3.6",

+ 13 - 7
src/store/modules/app.ts

@@ -1,4 +1,10 @@
-import type { ProjectConfig } from '/#/config';
+import type {
+  ProjectConfig,
+  HeaderSetting,
+  MenuSetting,
+  TransitionSetting,
+  MultiTabsSetting,
+} from '/#/config';
 import type { BeforeMiniState } from '/#/store';
 
 import { defineStore } from 'pinia';
@@ -30,14 +36,14 @@ export const useAppStore = defineStore({
     beforeMiniInfo: {},
   }),
   getters: {
-    getPageLoading() {
+    getPageLoading(): boolean {
       return this.pageLoading;
     },
     getDarkMode(): 'light' | 'dark' | string {
       return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
     },
 
-    getBeforeMiniInfo() {
+    getBeforeMiniInfo(): BeforeMiniState {
       return this.beforeMiniInfo;
     },
 
@@ -45,16 +51,16 @@ export const useAppStore = defineStore({
       return this.projectConfig || ({} as ProjectConfig);
     },
 
-    getHeaderSetting() {
+    getHeaderSetting(): HeaderSetting {
       return this.getProjectConfig.headerSetting;
     },
-    getMenuSetting() {
+    getMenuSetting(): MenuSetting {
       return this.getProjectConfig.menuSetting;
     },
-    getTransitionSetting() {
+    getTransitionSetting(): TransitionSetting {
       return this.getProjectConfig.transitionSetting;
     },
-    getMultiTabsSetting() {
+    getMultiTabsSetting(): MultiTabsSetting {
       return this.getProjectConfig.multiTabsSetting;
     },
   },

+ 2 - 2
src/store/modules/errorLog.ts

@@ -20,10 +20,10 @@ export const useErrorLogStore = defineStore({
     errorLogListCount: 0,
   }),
   getters: {
-    getErrorLogInfoList() {
+    getErrorLogInfoList(): ErrorLogInfo[] {
       return this.errorLogInfoList || [];
     },
-    getErrorLogListCount() {
+    getErrorLogListCount(): number {
       return this.errorLogListCount;
     },
   },

+ 1 - 1
src/store/modules/locale.ts

@@ -21,7 +21,7 @@ export const useLocaleStore = defineStore({
     localInfo: lsLocaleSetting,
   }),
   getters: {
-    getShowPicker() {
+    getShowPicker(): boolean {
       return !!this.localInfo?.showPicker;
     },
     getLocale(): LocaleType {

+ 1 - 1
src/store/modules/lock.ts

@@ -16,7 +16,7 @@ export const useLockStore = defineStore({
     lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
   }),
   getters: {
-    getLockInfo() {
+    getLockInfo(): Nullable<LockInfo> {
       return this.lockInfo;
     },
   },

+ 1 - 1
src/store/modules/multipleTab.ts

@@ -38,7 +38,7 @@ export const useMultipleTabStore = defineStore({
     lastDragEndIndex: 0,
   }),
   getters: {
-    getTabList() {
+    getTabList(): RouteLocationNormalized[] {
       return this.tabList;
     },
     getCachedTabList(): string[] {

+ 5 - 5
src/store/modules/permission.ts

@@ -25,7 +25,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
 
 interface PermissionState {
   // Permission code list
-  permCodeList: string[];
+  permCodeList: string[] | number[];
   // Whether the route has been dynamically added
   isDynamicAddedRoute: boolean;
   // To trigger a menu update
@@ -45,16 +45,16 @@ export const usePermissionStore = defineStore({
     backMenuList: [],
   }),
   getters: {
-    getPermCodeList() {
+    getPermCodeList(): string[] | number[] {
       return this.permCodeList;
     },
-    getBackMenuList() {
+    getBackMenuList(): Menu[] {
       return this.backMenuList;
     },
-    getLastBuildMenuTime() {
+    getLastBuildMenuTime(): number {
       return this.lastBuildMenuTime;
     },
-    getIsDynamicAddedRoute() {
+    getIsDynamicAddedRoute(): boolean {
       return this.isDynamicAddedRoute;
     },
   },

+ 35 - 33
yarn.lock

@@ -1431,10 +1431,10 @@
   dependencies:
     cross-fetch "^3.0.6"
 
-"@iconify/json@^1.1.357":
-  version "1.1.357"
-  resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.357.tgz#63dd3b358b80a3774e24ce0a136488b819a20dbd"
-  integrity sha512-X4tXnyCKCAKRopGtvQjp3LmPX3TaUUfi2DwD41SQItBp9PbsZXg9+tYJbWjl0+gFFv7ikdzAp+yGIaXuZT/k5g==
+"@iconify/json@^1.1.358":
+  version "1.1.358"
+  resolved "https://registry.yarnpkg.com/@iconify/json/-/json-1.1.358.tgz#173610937bca36f2ad194ed4adf2797a445e4852"
+  integrity sha512-FHNwGJiLHkYMxzxzdOAue1y3rizXkvlAqZesEo1gErJbad7Xri9uN2N2grT/GfHSKyhg5EiCMgV2E3VFV2wJMA==
 
 "@intlify/core-base@9.1.6":
   version "9.1.6"
@@ -1688,21 +1688,21 @@
     "@types/yargs" "^16.0.0"
     chalk "^4.0.0"
 
-"@logicflow/core@^0.4.15":
-  version "0.4.15"
-  resolved "https://registry.npmjs.org/@logicflow/core/-/core-0.4.15.tgz#0e13d51b64403416eed6a3229b2d232869ca8dd5"
-  integrity sha512-JtgRL/ZM+FjjibrOkswkuKzeX3XMnozmq/h0YC/HBRpv0ZHynrlCQGqI1SQsD3tDIkaN4wBnHM9DIqIIwf7ZBQ==
+"@logicflow/core@^0.5.0":
+  version "0.5.0"
+  resolved "https://registry.yarnpkg.com/@logicflow/core/-/core-0.5.0.tgz#c7068ce179400ae54927d71199288a304d2c9b9b"
+  integrity sha512-PG+7vsfQcUXyDIAtF7sU7eNk3++6BcXcknr50RlWdTcCvo+vPIRqM5d6eq291Srry7S4RAv7nsspAEjd8G0gkA==
   dependencies:
     "@types/mousetrap" "^1.6.4"
     mousetrap "^1.6.5"
     preact "^10.4.8"
 
-"@logicflow/extension@^0.4.15":
-  version "0.4.15"
-  resolved "https://registry.npmjs.org/@logicflow/extension/-/extension-0.4.15.tgz#d68e8824aca89b8966d71ec1a68ce95bebe3169a"
-  integrity sha512-J6BRp5ZpOY/kyQmT8eCiLM+y+OWKClNDpWmiVSYdp0Rr8fGH1U4A8ITYvcte45nXorHLcg659PdHZaYqZtzJog==
+"@logicflow/extension@^0.5.0":
+  version "0.5.0"
+  resolved "https://registry.yarnpkg.com/@logicflow/extension/-/extension-0.5.0.tgz#f512ba706a97deab8923b0e4efb1e545a35bb1a3"
+  integrity sha512-wAzQsidlFFOYxaFn6E6G1/BQu8rrjuoCNPz6lkQufJoRJ6pGrtL4tl0ERGP4ut+xyns/P6sOWDA2dsvZGtg6Vw==
   dependencies:
-    "@logicflow/core" "^0.4.15"
+    "@logicflow/core" "^0.5.0"
     ids "^1.0.0"
     preact "^10.4.8"
 
@@ -2133,10 +2133,10 @@
   dependencies:
     "@types/node" "*"
 
-"@types/inquirer@^7.3.1":
-  version "7.3.1"
-  resolved "https://registry.npmjs.org/@types/inquirer/-/inquirer-7.3.1.tgz#1f231224e7df11ccfaf4cf9acbcc3b935fea292d"
-  integrity sha512-osD38QVIfcdgsPCT0V3lD7eH0OFurX71Jft18bZrsVQWVRt6TuxRzlr0GJLrxoHZR2V5ph7/qP8se/dcnI7o0g==
+"@types/inquirer@^7.3.2":
+  version "7.3.2"
+  resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-7.3.2.tgz#35d2ef4d98dd42feeb4e1256cdeb9f13f457d420"
+  integrity sha512-EkeX/hU0SWinA2c7Qu/+6+7KbepFPYJcjankUgtA/VSY6BlVHybL0Cgyey9PDbXwhNXnNGBLU3t+MORp23RgAw==
   dependencies:
     "@types/through" "*"
     rxjs "^6.4.0"
@@ -2227,10 +2227,10 @@
   resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.1.tgz#5e07e0cb2ff793aa7a1b41deae76221e6166049f"
   integrity sha512-/tpUyFD7meeooTRwl3sYlihx2BrJE7q9XF71EguPFIySj9B7qgnRtHsHTho+0AUm4m1SvWGm6uSncrR94q6Vtw==
 
-"@types/node@^15.12.2":
-  version "15.12.2"
-  resolved "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz#1f2b42c4be7156ff4a6f914b2fb03d05fa84e38d"
-  integrity sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==
+"@types/node@^15.12.4":
+  version "15.12.4"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.4.tgz#e1cf817d70a1e118e81922c4ff6683ce9d422e26"
+  integrity sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==
 
 "@types/normalize-package-data@^2.4.0":
   version "2.4.0"
@@ -5148,10 +5148,10 @@ eslint-visitor-keys@^2.0.0:
   resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
   integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
 
-eslint@^7.28.0:
-  version "7.28.0"
-  resolved "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz#435aa17a0b82c13bb2be9d51408b617e49c1e820"
-  integrity sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==
+eslint@^7.29.0:
+  version "7.29.0"
+  resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.29.0.tgz#ee2a7648f2e729485e4d0bd6383ec1deabc8b3c0"
+  integrity sha512-82G/JToB9qIy/ArBzIWG9xvvwL3R86AlCjtGw+A29OMZDqhTybz/MByORSukGxeI+YPCR4coYyITKk8BFH9nDA==
   dependencies:
     "@babel/code-frame" "7.12.11"
     "@eslint/eslintrc" "^0.4.2"
@@ -6760,10 +6760,10 @@ into-stream@^3.1.0:
     from2 "^2.1.1"
     p-is-promise "^1.1.0"
 
-intro.js@^4.0.0:
-  version "4.0.0"
-  resolved "https://registry.npmjs.org/intro.js/-/intro.js-4.0.0.tgz#6897f0dc6bb9997f73613ae3c7cd26e16b05a5eb"
-  integrity sha512-IS8+p4rpnWUq2Vd8YRgjR8w9lbyLvT0ptscBqA4iudO68oven39CvxHfxopfwlNUGgmgcyX17DOETof+D90AXA==
+intro.js@^4.1.0:
+  version "4.1.0"
+  resolved "https://registry.yarnpkg.com/intro.js/-/intro.js-4.1.0.tgz#7e4ae5877df0c452b23d1fd96f2666eb87796b22"
+  integrity sha512-+Y+UsP+yvqqlEOjFExMBXKopn3nzwc91PaUl0SrvqiVs6ztko1DzfkoXR2AnfirZVZZhr5Aej6wlXRlvIkuMcA==
 
 is-accessor-descriptor@^0.1.6:
   version "0.1.6"
@@ -9411,10 +9411,12 @@ pify@^4.0.1:
   resolved "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
   integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
 
-pinia@2.0.0-alpha.13:
-  version "2.0.0-alpha.13"
-  resolved "https://registry.npmjs.com/pinia/-/pinia-2.0.0-alpha.13.tgz#d48e6efec11d38201e20770bc02b168e2157a9f7"
-  integrity sha512-3r9fpUi5Uai48vjeTXzcHAvlDjYvx/9mNtWiO5QyWy4zqfn7YjvOiBCHXH9r1jwo4LakZzG/ppr5i6sr/63fYQ==
+pinia@2.0.0-beta.3:
+  version "2.0.0-beta.3"
+  resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.0-beta.3.tgz#c6f0d07da54dc5aa237f4cc9281898e927b33d16"
+  integrity sha512-4ygKhe9FrYD69tJ7nSdgHm9Ldb0aM/Nzyb8Qz/RZuzOyOr85jWHNmCAhCytWy0l9C4/ypGJYCEJ3vuZfyWjcZA==
+  dependencies:
+    "@vue/devtools-api" "^6.0.0-beta.14"
 
 pinkie-promise@^2.0.0:
   version "2.0.1"