Commit e8d6f8851efd7076946486864936f1797280d3ba

Authored by vben
1 parent 7dce50cb

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

.vscode/settings.json
... ... @@ -118,5 +118,15 @@
118 118 "i18n-ally.enabledParsers": ["ts"],
119 119 "i18n-ally.sourceLanguage": "en",
120 120 "i18n-ally.enabledFrameworks": ["vue", "react"],
121   - "cSpell.words": ["vben", "windi", "browserslist", "esnext", "antv", "tinymce", "qrcode", "sider"]
  121 + "cSpell.words": [
  122 + "vben",
  123 + "windi",
  124 + "browserslist",
  125 + "esnext",
  126 + "antv",
  127 + "tinymce",
  128 + "qrcode",
  129 + "sider",
  130 + "pinia"
  131 + ]
122 132 }
... ...
CHANGELOG.zh_CN.md
... ... @@ -30,6 +30,7 @@
30 30 - 修复后台模式下,Iframe 路由错误
31 31 - **PageWrapper** 修复 footer 与全局页脚同时开启时的高度计算问题
32 32 - **Menu** 修复菜单折叠动画抖动问题
  33 +- **Store**修复 pinia 版本升级之后类型错误
33 34  
34 35 ## 2.4.2(2021-06-10)
35 36  
... ...
package.json
... ... @@ -35,8 +35,8 @@
35 35 },
36 36 "dependencies": {
37 37 "@iconify/iconify": "^2.0.2",
38   - "@logicflow/core": "^0.4.15",
39   - "@logicflow/extension": "^0.4.15",
  38 + "@logicflow/core": "^0.5.0",
  39 + "@logicflow/extension": "^0.5.0",
40 40 "@vueuse/core": "^5.0.3",
41 41 "@zxcvbn-ts/core": "^0.3.0",
42 42 "ant-design-vue": "2.1.6",
... ... @@ -45,12 +45,12 @@
45 45 "cropperjs": "^1.5.12",
46 46 "crypto-js": "^4.0.0",
47 47 "echarts": "^5.1.2",
48   - "intro.js": "^4.0.0",
  48 + "intro.js": "^4.1.0",
49 49 "lodash-es": "^4.17.21",
50 50 "mockjs": "^1.1.0",
51 51 "nprogress": "^0.2.0",
52 52 "path-to-regexp": "^6.2.0",
53   - "pinia": "2.0.0-alpha.13",
  53 + "pinia": "2.0.0-beta.3",
54 54 "print-js": "^1.6.0",
55 55 "qrcode": "^1.4.4",
56 56 "sortablejs": "^1.13.0",
... ... @@ -66,17 +66,17 @@
66 66 "devDependencies": {
67 67 "@commitlint/cli": "^12.1.4",
68 68 "@commitlint/config-conventional": "^12.1.4",
69   - "@iconify/json": "^1.1.357",
  69 + "@iconify/json": "^1.1.358",
70 70 "@purge-icons/generated": "^0.7.0",
71 71 "@types/codemirror": "^5.60.0",
72 72 "@types/crypto-js": "^4.0.1",
73 73 "@types/fs-extra": "^9.0.11",
74   - "@types/inquirer": "^7.3.1",
  74 + "@types/inquirer": "^7.3.2",
75 75 "@types/intro.js": "^3.0.1",
76 76 "@types/jest": "^26.0.23",
77 77 "@types/lodash-es": "^4.17.4",
78 78 "@types/mockjs": "^1.0.3",
79   - "@types/node": "^15.12.2",
  79 + "@types/node": "^15.12.4",
80 80 "@types/nprogress": "^0.2.0",
81 81 "@types/qrcode": "^1.4.0",
82 82 "@types/qs": "^6.9.6",
... ... @@ -94,7 +94,7 @@
94 94 "conventional-changelog-cli": "^2.1.1",
95 95 "cross-env": "^7.0.3",
96 96 "dotenv": "^10.0.0",
97   - "eslint": "^7.28.0",
  97 + "eslint": "^7.29.0",
98 98 "eslint-config-prettier": "^8.3.0",
99 99 "eslint-define-config": "^1.0.8",
100 100 "eslint-plugin-jest": "^24.3.6",
... ...
src/store/modules/app.ts
1   -import type { ProjectConfig } from '/#/config';
  1 +import type {
  2 + ProjectConfig,
  3 + HeaderSetting,
  4 + MenuSetting,
  5 + TransitionSetting,
  6 + MultiTabsSetting,
  7 +} from '/#/config';
2 8 import type { BeforeMiniState } from '/#/store';
3 9  
4 10 import { defineStore } from 'pinia';
... ... @@ -30,14 +36,14 @@ export const useAppStore = defineStore({
30 36 beforeMiniInfo: {},
31 37 }),
32 38 getters: {
33   - getPageLoading() {
  39 + getPageLoading(): boolean {
34 40 return this.pageLoading;
35 41 },
36 42 getDarkMode(): 'light' | 'dark' | string {
37 43 return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
38 44 },
39 45  
40   - getBeforeMiniInfo() {
  46 + getBeforeMiniInfo(): BeforeMiniState {
41 47 return this.beforeMiniInfo;
42 48 },
43 49  
... ... @@ -45,16 +51,16 @@ export const useAppStore = defineStore({
45 51 return this.projectConfig || ({} as ProjectConfig);
46 52 },
47 53  
48   - getHeaderSetting() {
  54 + getHeaderSetting(): HeaderSetting {
49 55 return this.getProjectConfig.headerSetting;
50 56 },
51   - getMenuSetting() {
  57 + getMenuSetting(): MenuSetting {
52 58 return this.getProjectConfig.menuSetting;
53 59 },
54   - getTransitionSetting() {
  60 + getTransitionSetting(): TransitionSetting {
55 61 return this.getProjectConfig.transitionSetting;
56 62 },
57   - getMultiTabsSetting() {
  63 + getMultiTabsSetting(): MultiTabsSetting {
58 64 return this.getProjectConfig.multiTabsSetting;
59 65 },
60 66 },
... ...
src/store/modules/errorLog.ts
... ... @@ -20,10 +20,10 @@ export const useErrorLogStore = defineStore({
20 20 errorLogListCount: 0,
21 21 }),
22 22 getters: {
23   - getErrorLogInfoList() {
  23 + getErrorLogInfoList(): ErrorLogInfo[] {
24 24 return this.errorLogInfoList || [];
25 25 },
26   - getErrorLogListCount() {
  26 + getErrorLogListCount(): number {
27 27 return this.errorLogListCount;
28 28 },
29 29 },
... ...
src/store/modules/locale.ts
... ... @@ -21,7 +21,7 @@ export const useLocaleStore = defineStore({
21 21 localInfo: lsLocaleSetting,
22 22 }),
23 23 getters: {
24   - getShowPicker() {
  24 + getShowPicker(): boolean {
25 25 return !!this.localInfo?.showPicker;
26 26 },
27 27 getLocale(): LocaleType {
... ...
src/store/modules/lock.ts
... ... @@ -16,7 +16,7 @@ export const useLockStore = defineStore({
16 16 lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
17 17 }),
18 18 getters: {
19   - getLockInfo() {
  19 + getLockInfo(): Nullable<LockInfo> {
20 20 return this.lockInfo;
21 21 },
22 22 },
... ...
src/store/modules/multipleTab.ts
... ... @@ -38,7 +38,7 @@ export const useMultipleTabStore = defineStore({
38 38 lastDragEndIndex: 0,
39 39 }),
40 40 getters: {
41   - getTabList() {
  41 + getTabList(): RouteLocationNormalized[] {
42 42 return this.tabList;
43 43 },
44 44 getCachedTabList(): string[] {
... ...
src/store/modules/permission.ts
... ... @@ -25,7 +25,7 @@ import { useMessage } from &#39;/@/hooks/web/useMessage&#39;;
25 25  
26 26 interface PermissionState {
27 27 // Permission code list
28   - permCodeList: string[];
  28 + permCodeList: string[] | number[];
29 29 // Whether the route has been dynamically added
30 30 isDynamicAddedRoute: boolean;
31 31 // To trigger a menu update
... ... @@ -45,16 +45,16 @@ export const usePermissionStore = defineStore({
45 45 backMenuList: [],
46 46 }),
47 47 getters: {
48   - getPermCodeList() {
  48 + getPermCodeList(): string[] | number[] {
49 49 return this.permCodeList;
50 50 },
51   - getBackMenuList() {
  51 + getBackMenuList(): Menu[] {
52 52 return this.backMenuList;
53 53 },
54   - getLastBuildMenuTime() {
  54 + getLastBuildMenuTime(): number {
55 55 return this.lastBuildMenuTime;
56 56 },
57   - getIsDynamicAddedRoute() {
  57 + getIsDynamicAddedRoute(): boolean {
58 58 return this.isDynamicAddedRoute;
59 59 },
60 60 },
... ...
yarn.lock
... ... @@ -1431,10 +1431,10 @@
1431 1431 dependencies:
1432 1432 cross-fetch "^3.0.6"
1433 1433  
1434   -"@iconify/json@^1.1.357":
1435   - version "1.1.357"
1436   - resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.357.tgz#63dd3b358b80a3774e24ce0a136488b819a20dbd"
1437   - integrity sha512-X4tXnyCKCAKRopGtvQjp3LmPX3TaUUfi2DwD41SQItBp9PbsZXg9+tYJbWjl0+gFFv7ikdzAp+yGIaXuZT/k5g==
  1434 +"@iconify/json@^1.1.358":
  1435 + version "1.1.358"
  1436 + resolved "https://registry.yarnpkg.com/@iconify/json/-/json-1.1.358.tgz#173610937bca36f2ad194ed4adf2797a445e4852"
  1437 + integrity sha512-FHNwGJiLHkYMxzxzdOAue1y3rizXkvlAqZesEo1gErJbad7Xri9uN2N2grT/GfHSKyhg5EiCMgV2E3VFV2wJMA==
1438 1438  
1439 1439 "@intlify/core-base@9.1.6":
1440 1440 version "9.1.6"
... ... @@ -1688,21 +1688,21 @@
1688 1688 "@types/yargs" "^16.0.0"
1689 1689 chalk "^4.0.0"
1690 1690  
1691   -"@logicflow/core@^0.4.15":
1692   - version "0.4.15"
1693   - resolved "https://registry.npmjs.org/@logicflow/core/-/core-0.4.15.tgz#0e13d51b64403416eed6a3229b2d232869ca8dd5"
1694   - integrity sha512-JtgRL/ZM+FjjibrOkswkuKzeX3XMnozmq/h0YC/HBRpv0ZHynrlCQGqI1SQsD3tDIkaN4wBnHM9DIqIIwf7ZBQ==
  1691 +"@logicflow/core@^0.5.0":
  1692 + version "0.5.0"
  1693 + resolved "https://registry.yarnpkg.com/@logicflow/core/-/core-0.5.0.tgz#c7068ce179400ae54927d71199288a304d2c9b9b"
  1694 + integrity sha512-PG+7vsfQcUXyDIAtF7sU7eNk3++6BcXcknr50RlWdTcCvo+vPIRqM5d6eq291Srry7S4RAv7nsspAEjd8G0gkA==
1695 1695 dependencies:
1696 1696 "@types/mousetrap" "^1.6.4"
1697 1697 mousetrap "^1.6.5"
1698 1698 preact "^10.4.8"
1699 1699  
1700   -"@logicflow/extension@^0.4.15":
1701   - version "0.4.15"
1702   - resolved "https://registry.npmjs.org/@logicflow/extension/-/extension-0.4.15.tgz#d68e8824aca89b8966d71ec1a68ce95bebe3169a"
1703   - integrity sha512-J6BRp5ZpOY/kyQmT8eCiLM+y+OWKClNDpWmiVSYdp0Rr8fGH1U4A8ITYvcte45nXorHLcg659PdHZaYqZtzJog==
  1700 +"@logicflow/extension@^0.5.0":
  1701 + version "0.5.0"
  1702 + resolved "https://registry.yarnpkg.com/@logicflow/extension/-/extension-0.5.0.tgz#f512ba706a97deab8923b0e4efb1e545a35bb1a3"
  1703 + integrity sha512-wAzQsidlFFOYxaFn6E6G1/BQu8rrjuoCNPz6lkQufJoRJ6pGrtL4tl0ERGP4ut+xyns/P6sOWDA2dsvZGtg6Vw==
1704 1704 dependencies:
1705   - "@logicflow/core" "^0.4.15"
  1705 + "@logicflow/core" "^0.5.0"
1706 1706 ids "^1.0.0"
1707 1707 preact "^10.4.8"
1708 1708  
... ... @@ -2133,10 +2133,10 @@
2133 2133 dependencies:
2134 2134 "@types/node" "*"
2135 2135  
2136   -"@types/inquirer@^7.3.1":
2137   - version "7.3.1"
2138   - resolved "https://registry.npmjs.org/@types/inquirer/-/inquirer-7.3.1.tgz#1f231224e7df11ccfaf4cf9acbcc3b935fea292d"
2139   - integrity sha512-osD38QVIfcdgsPCT0V3lD7eH0OFurX71Jft18bZrsVQWVRt6TuxRzlr0GJLrxoHZR2V5ph7/qP8se/dcnI7o0g==
  2136 +"@types/inquirer@^7.3.2":
  2137 + version "7.3.2"
  2138 + resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-7.3.2.tgz#35d2ef4d98dd42feeb4e1256cdeb9f13f457d420"
  2139 + integrity sha512-EkeX/hU0SWinA2c7Qu/+6+7KbepFPYJcjankUgtA/VSY6BlVHybL0Cgyey9PDbXwhNXnNGBLU3t+MORp23RgAw==
2140 2140 dependencies:
2141 2141 "@types/through" "*"
2142 2142 rxjs "^6.4.0"
... ... @@ -2227,10 +2227,10 @@
2227 2227 resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.1.tgz#5e07e0cb2ff793aa7a1b41deae76221e6166049f"
2228 2228 integrity sha512-/tpUyFD7meeooTRwl3sYlihx2BrJE7q9XF71EguPFIySj9B7qgnRtHsHTho+0AUm4m1SvWGm6uSncrR94q6Vtw==
2229 2229  
2230   -"@types/node@^15.12.2":
2231   - version "15.12.2"
2232   - resolved "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz#1f2b42c4be7156ff4a6f914b2fb03d05fa84e38d"
2233   - integrity sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==
  2230 +"@types/node@^15.12.4":
  2231 + version "15.12.4"
  2232 + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.4.tgz#e1cf817d70a1e118e81922c4ff6683ce9d422e26"
  2233 + integrity sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==
2234 2234  
2235 2235 "@types/normalize-package-data@^2.4.0":
2236 2236 version "2.4.0"
... ... @@ -5148,10 +5148,10 @@ eslint-visitor-keys@^2.0.0:
5148 5148 resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
5149 5149 integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
5150 5150  
5151   -eslint@^7.28.0:
5152   - version "7.28.0"
5153   - resolved "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz#435aa17a0b82c13bb2be9d51408b617e49c1e820"
5154   - integrity sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==
  5151 +eslint@^7.29.0:
  5152 + version "7.29.0"
  5153 + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.29.0.tgz#ee2a7648f2e729485e4d0bd6383ec1deabc8b3c0"
  5154 + integrity sha512-82G/JToB9qIy/ArBzIWG9xvvwL3R86AlCjtGw+A29OMZDqhTybz/MByORSukGxeI+YPCR4coYyITKk8BFH9nDA==
5155 5155 dependencies:
5156 5156 "@babel/code-frame" "7.12.11"
5157 5157 "@eslint/eslintrc" "^0.4.2"
... ... @@ -6760,10 +6760,10 @@ into-stream@^3.1.0:
6760 6760 from2 "^2.1.1"
6761 6761 p-is-promise "^1.1.0"
6762 6762  
6763   -intro.js@^4.0.0:
6764   - version "4.0.0"
6765   - resolved "https://registry.npmjs.org/intro.js/-/intro.js-4.0.0.tgz#6897f0dc6bb9997f73613ae3c7cd26e16b05a5eb"
6766   - integrity sha512-IS8+p4rpnWUq2Vd8YRgjR8w9lbyLvT0ptscBqA4iudO68oven39CvxHfxopfwlNUGgmgcyX17DOETof+D90AXA==
  6763 +intro.js@^4.1.0:
  6764 + version "4.1.0"
  6765 + resolved "https://registry.yarnpkg.com/intro.js/-/intro.js-4.1.0.tgz#7e4ae5877df0c452b23d1fd96f2666eb87796b22"
  6766 + integrity sha512-+Y+UsP+yvqqlEOjFExMBXKopn3nzwc91PaUl0SrvqiVs6ztko1DzfkoXR2AnfirZVZZhr5Aej6wlXRlvIkuMcA==
6767 6767  
6768 6768 is-accessor-descriptor@^0.1.6:
6769 6769 version "0.1.6"
... ... @@ -9411,10 +9411,12 @@ pify@^4.0.1:
9411 9411 resolved "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
9412 9412 integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
9413 9413  
9414   -pinia@2.0.0-alpha.13:
9415   - version "2.0.0-alpha.13"
9416   - resolved "https://registry.npmjs.com/pinia/-/pinia-2.0.0-alpha.13.tgz#d48e6efec11d38201e20770bc02b168e2157a9f7"
9417   - integrity sha512-3r9fpUi5Uai48vjeTXzcHAvlDjYvx/9mNtWiO5QyWy4zqfn7YjvOiBCHXH9r1jwo4LakZzG/ppr5i6sr/63fYQ==
  9414 +pinia@2.0.0-beta.3:
  9415 + version "2.0.0-beta.3"
  9416 + resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.0-beta.3.tgz#c6f0d07da54dc5aa237f4cc9281898e927b33d16"
  9417 + integrity sha512-4ygKhe9FrYD69tJ7nSdgHm9Ldb0aM/Nzyb8Qz/RZuzOyOr85jWHNmCAhCytWy0l9C4/ypGJYCEJ3vuZfyWjcZA==
  9418 + dependencies:
  9419 + "@vue/devtools-api" "^6.0.0-beta.14"
9418 9420  
9419 9421 pinkie-promise@^2.0.0:
9420 9422 version "2.0.1"
... ...