Skip to content

Commit e8d6f88

Browse files
committed
fix(store): fix type error after pinia version upgrade
1 parent 7dce50c commit e8d6f88

File tree

10 files changed

+78
-59
lines changed

10 files changed

+78
-59
lines changed

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,15 @@
118118
"i18n-ally.enabledParsers": ["ts"],
119119
"i18n-ally.sourceLanguage": "en",
120120
"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+
]
122132
}

CHANGELOG.zh_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- 修复后台模式下,Iframe 路由错误
3131
- **PageWrapper** 修复 footer 与全局页脚同时开启时的高度计算问题
3232
- **Menu** 修复菜单折叠动画抖动问题
33+
- **Store**修复 pinia 版本升级之后类型错误
3334

3435
## 2.4.2(2021-06-10)
3536

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
},
3636
"dependencies": {
3737
"@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",
4040
"@vueuse/core": "^5.0.3",
4141
"@zxcvbn-ts/core": "^0.3.0",
4242
"ant-design-vue": "2.1.6",
@@ -45,12 +45,12 @@
4545
"cropperjs": "^1.5.12",
4646
"crypto-js": "^4.0.0",
4747
"echarts": "^5.1.2",
48-
"intro.js": "^4.0.0",
48+
"intro.js": "^4.1.0",
4949
"lodash-es": "^4.17.21",
5050
"mockjs": "^1.1.0",
5151
"nprogress": "^0.2.0",
5252
"path-to-regexp": "^6.2.0",
53-
"pinia": "2.0.0-alpha.13",
53+
"pinia": "2.0.0-beta.3",
5454
"print-js": "^1.6.0",
5555
"qrcode": "^1.4.4",
5656
"sortablejs": "^1.13.0",
@@ -66,17 +66,17 @@
6666
"devDependencies": {
6767
"@commitlint/cli": "^12.1.4",
6868
"@commitlint/config-conventional": "^12.1.4",
69-
"@iconify/json": "^1.1.357",
69+
"@iconify/json": "^1.1.358",
7070
"@purge-icons/generated": "^0.7.0",
7171
"@types/codemirror": "^5.60.0",
7272
"@types/crypto-js": "^4.0.1",
7373
"@types/fs-extra": "^9.0.11",
74-
"@types/inquirer": "^7.3.1",
74+
"@types/inquirer": "^7.3.2",
7575
"@types/intro.js": "^3.0.1",
7676
"@types/jest": "^26.0.23",
7777
"@types/lodash-es": "^4.17.4",
7878
"@types/mockjs": "^1.0.3",
79-
"@types/node": "^15.12.2",
79+
"@types/node": "^15.12.4",
8080
"@types/nprogress": "^0.2.0",
8181
"@types/qrcode": "^1.4.0",
8282
"@types/qs": "^6.9.6",
@@ -94,7 +94,7 @@
9494
"conventional-changelog-cli": "^2.1.1",
9595
"cross-env": "^7.0.3",
9696
"dotenv": "^10.0.0",
97-
"eslint": "^7.28.0",
97+
"eslint": "^7.29.0",
9898
"eslint-config-prettier": "^8.3.0",
9999
"eslint-define-config": "^1.0.8",
100100
"eslint-plugin-jest": "^24.3.6",

src/store/modules/app.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import type { ProjectConfig } from '/#/config';
1+
import type {
2+
ProjectConfig,
3+
HeaderSetting,
4+
MenuSetting,
5+
TransitionSetting,
6+
MultiTabsSetting,
7+
} from '/#/config';
28
import type { BeforeMiniState } from '/#/store';
39

410
import { defineStore } from 'pinia';
@@ -30,31 +36,31 @@ export const useAppStore = defineStore({
3036
beforeMiniInfo: {},
3137
}),
3238
getters: {
33-
getPageLoading() {
39+
getPageLoading(): boolean {
3440
return this.pageLoading;
3541
},
3642
getDarkMode(): 'light' | 'dark' | string {
3743
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
3844
},
3945

40-
getBeforeMiniInfo() {
46+
getBeforeMiniInfo(): BeforeMiniState {
4147
return this.beforeMiniInfo;
4248
},
4349

4450
getProjectConfig(): ProjectConfig {
4551
return this.projectConfig || ({} as ProjectConfig);
4652
},
4753

48-
getHeaderSetting() {
54+
getHeaderSetting(): HeaderSetting {
4955
return this.getProjectConfig.headerSetting;
5056
},
51-
getMenuSetting() {
57+
getMenuSetting(): MenuSetting {
5258
return this.getProjectConfig.menuSetting;
5359
},
54-
getTransitionSetting() {
60+
getTransitionSetting(): TransitionSetting {
5561
return this.getProjectConfig.transitionSetting;
5662
},
57-
getMultiTabsSetting() {
63+
getMultiTabsSetting(): MultiTabsSetting {
5864
return this.getProjectConfig.multiTabsSetting;
5965
},
6066
},

src/store/modules/errorLog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export const useErrorLogStore = defineStore({
2020
errorLogListCount: 0,
2121
}),
2222
getters: {
23-
getErrorLogInfoList() {
23+
getErrorLogInfoList(): ErrorLogInfo[] {
2424
return this.errorLogInfoList || [];
2525
},
26-
getErrorLogListCount() {
26+
getErrorLogListCount(): number {
2727
return this.errorLogListCount;
2828
},
2929
},

src/store/modules/locale.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const useLocaleStore = defineStore({
2121
localInfo: lsLocaleSetting,
2222
}),
2323
getters: {
24-
getShowPicker() {
24+
getShowPicker(): boolean {
2525
return !!this.localInfo?.showPicker;
2626
},
2727
getLocale(): LocaleType {

src/store/modules/lock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const useLockStore = defineStore({
1616
lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
1717
}),
1818
getters: {
19-
getLockInfo() {
19+
getLockInfo(): Nullable<LockInfo> {
2020
return this.lockInfo;
2121
},
2222
},

src/store/modules/multipleTab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const useMultipleTabStore = defineStore({
3838
lastDragEndIndex: 0,
3939
}),
4040
getters: {
41-
getTabList() {
41+
getTabList(): RouteLocationNormalized[] {
4242
return this.tabList;
4343
},
4444
getCachedTabList(): string[] {

src/store/modules/permission.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
2525

2626
interface PermissionState {
2727
// Permission code list
28-
permCodeList: string[];
28+
permCodeList: string[] | number[];
2929
// Whether the route has been dynamically added
3030
isDynamicAddedRoute: boolean;
3131
// To trigger a menu update
@@ -45,16 +45,16 @@ export const usePermissionStore = defineStore({
4545
backMenuList: [],
4646
}),
4747
getters: {
48-
getPermCodeList() {
48+
getPermCodeList(): string[] | number[] {
4949
return this.permCodeList;
5050
},
51-
getBackMenuList() {
51+
getBackMenuList(): Menu[] {
5252
return this.backMenuList;
5353
},
54-
getLastBuildMenuTime() {
54+
getLastBuildMenuTime(): number {
5555
return this.lastBuildMenuTime;
5656
},
57-
getIsDynamicAddedRoute() {
57+
getIsDynamicAddedRoute(): boolean {
5858
return this.isDynamicAddedRoute;
5959
},
6060
},

yarn.lock

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,10 +1431,10 @@
14311431
dependencies:
14321432
cross-fetch "^3.0.6"
14331433

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==
14381438

14391439
"@intlify/core-base@9.1.6":
14401440
version "9.1.6"
@@ -1688,21 +1688,21 @@
16881688
"@types/yargs" "^16.0.0"
16891689
chalk "^4.0.0"
16901690

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==
16951695
dependencies:
16961696
"@types/mousetrap" "^1.6.4"
16971697
mousetrap "^1.6.5"
16981698
preact "^10.4.8"
16991699

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==
17041704
dependencies:
1705-
"@logicflow/core" "^0.4.15"
1705+
"@logicflow/core" "^0.5.0"
17061706
ids "^1.0.0"
17071707
preact "^10.4.8"
17081708

@@ -2133,10 +2133,10 @@
21332133
dependencies:
21342134
"@types/node" "*"
21352135

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==
21402140
dependencies:
21412141
"@types/through" "*"
21422142
rxjs "^6.4.0"
@@ -2227,10 +2227,10 @@
22272227
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.1.tgz#5e07e0cb2ff793aa7a1b41deae76221e6166049f"
22282228
integrity sha512-/tpUyFD7meeooTRwl3sYlihx2BrJE7q9XF71EguPFIySj9B7qgnRtHsHTho+0AUm4m1SvWGm6uSncrR94q6Vtw==
22292229

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==
22342234

22352235
"@types/normalize-package-data@^2.4.0":
22362236
version "2.4.0"
@@ -5148,10 +5148,10 @@ eslint-visitor-keys@^2.0.0:
51485148
resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
51495149
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
51505150

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==
51555155
dependencies:
51565156
"@babel/code-frame" "7.12.11"
51575157
"@eslint/eslintrc" "^0.4.2"
@@ -6760,10 +6760,10 @@ into-stream@^3.1.0:
67606760
from2 "^2.1.1"
67616761
p-is-promise "^1.1.0"
67626762

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==
67676767

67686768
is-accessor-descriptor@^0.1.6:
67696769
version "0.1.6"
@@ -9411,10 +9411,12 @@ pify@^4.0.1:
94119411
resolved "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
94129412
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
94139413

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"
94189420

94199421
pinkie-promise@^2.0.0:
94209422
version "2.0.1"

0 commit comments

Comments
 (0)