Skip to content

Commit 066d2be

Browse files
author
白唯
committed
feat(vuex): 完善 vuex ts 类型,重构简易读取方法
1 parent 366d49c commit 066d2be

File tree

13 files changed

+807
-551
lines changed

13 files changed

+807
-551
lines changed

.editorconfig

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
root = true
33
[*.{js,jsx,ts,tsx,vue}]
44
charset = utf-8
5-
indent_style = tab
65
indent_size = 2
76
trim_trailing_whitespace = true
87
insert_final_newline = true
@@ -19,4 +18,3 @@ charset = utf-8
1918
# 设置所有JS,vue的缩进为
2019
[*.{js,vue}]
2120

22-
indent_style = tab

@types/index.d.ts

+14-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import { RootStateType } from '@/store/state'
2-
import { AppStateType } from '@/store/modules/app/state'
3-
import { createStore } from 'vuex'
4-
5-
export declare interface StoreInstance extends ReturnType<typeof createStore> {
6-
__s?: (type: string, val: any) => any
7-
__g?: (type: string, val: any) => any
8-
}
9-
10-
// vuex模块的类型
11-
type ModuleType = { app: AppStateType }
12-
13-
// 所有的StateType
14-
export type StateType = ModuleType & RootStateType & StoreInstance
15-
16-
/** http请求响应格式 */
17-
export declare interface ApiResponse {
18-
errCode: number
19-
errMsg?: string
20-
data?: any
21-
}
1+
import { AppStateType } from '@/store/modules/app/state'
2+
3+
// vuex模块的类型
4+
type ModuleType = { app: AppStateType }
5+
6+
// 所有的StateType
7+
export type StateType = ModuleType
8+
9+
/** http请求响应格式 */
10+
export declare interface ApiResponse {
11+
errCode: number
12+
errMsg?: string
13+
data?: any
14+
}

CHANGELOG.md

+117-87
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,117 @@
1-
## [0.1.7](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.7) (2020-09-29)
2-
3-
4-
### Bug Fixes
5-
6-
* **less:** 更新 less 版本,兼容 antdv ([1f9c248](https://github.com/ibwei/vue3-base/commit/1f9c2488fa35fc4e8fe52229db48ca1f53813fb1))
7-
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
8-
* **types:** 更改部分 type 说明 ([89b0a19](https://github.com/ibwei/vue3-base/commit/89b0a193629576f49146d968460658c66e8e1895))
9-
* **vue3:** 更新到 vue3 正式版并修复错误 ([074b83a](https://github.com/ibwei/vue3-base/commit/074b83a8db7ed1f68d6fb4faf0f04302743a02c5))
10-
11-
12-
### Features
13-
14-
* **i18n:** 主要增加了国际化方案 ([7affdf8](https://github.com/ibwei/vue3-base/commit/7affdf821bf934e4fc364ab89bb9731475987141))
15-
* **vuex:** 添加了 vuex 打印日志服务 ([badae42](https://github.com/ibwei/vue3-base/commit/badae42d9561fc155a45b152f496e2ca955a5532))
16-
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))
17-
18-
19-
### Performance Improvements
20-
21-
* **插件:** 插件更新为自动化加载 ([e0d39c4](https://github.com/ibwei/vue3-base/commit/e0d39c43c81c21d50c250a9d833d9d012ff7a55b))
22-
23-
24-
25-
## [0.1.6](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.6) (2020-09-17)
26-
27-
28-
### Bug Fixes
29-
30-
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
31-
32-
33-
### Features
34-
35-
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))
36-
37-
38-
39-
## 0.1.5 (2020-09-09)
40-
41-
### Bug Fixes
42-
43-
- **修复提交工具:** 更改 git-cz 配置文件 ([372391f](https://github.com/ibwei/vue3-base/commit/372391f79e177c685277409ad873cd963c756ee3))
44-
45-
### Features
46-
47-
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 ([d4e8514](https://github.com/ibwei/vue3-base/commit/d4e851421b72b7f2ff273d8ebc72c08919b94392))
48-
- **完善 type:** 将第三方库的类型添加到每一个 vue 组件实例中去 ([13b84ab](https://github.com/ibwei/vue3-base/commit/13b84ab084ee388e114618db31ab801d28143bdf))
49-
- **补全基础代码:** 更换 types 位置,增加 layout 文件,修复 docs 文档,修改 tsconfig 配置等 ([d56645f](https://github.com/ibwei/vue3-base/commit/d56645fcf33959bcf57453690201be3cdd55620c))
50-
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 ([f3da208](https://github.com/ibwei/vue3-base/commit/f3da208fa7bcd9141c829327cf949aaf486a0ce7))
51-
52-
## 0.1.4 (2020-09-05)
53-
54-
### Bug Fixes
55-
56-
- **修复提交工具:** 更改 git-cz 配置文件 ([372391f](https://github.com/ibwei/vue3-base/commit/372391f79e177c685277409ad873cd963c756ee3))
57-
58-
### Features
59-
60-
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 ([d4e8514](https://github.com/ibwei/vue3-base/commit/d4e851421b72b7f2ff273d8ebc72c08919b94392))
61-
- **完善 type:** 将第三方库的类型添加到每一个 vue 组件实例中去 ([13b84ab](https://github.com/ibwei/vue3-base/commit/13b84ab084ee388e114618db31ab801d28143bdf))
62-
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 ([f3da208](https://github.com/ibwei/vue3-base/commit/f3da208fa7bcd9141c829327cf949aaf486a0ce7))
63-
64-
## 0.1.3 (2020-09-04)
65-
66-
### Bug Fixes
67-
68-
- **修复提交工具:** 更改 git-cz 配置文件 372391f
69-
70-
### Features
71-
72-
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
73-
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208
74-
75-
## 0.1.2 (2020-09-03)
76-
77-
### Features
78-
79-
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
80-
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208
81-
82-
## 0.1.1 (2020-09-03)
83-
84-
### Features
85-
86-
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
87-
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208
1+
## [0.1.9](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.9) (2020-10-17)
2+
3+
4+
### Bug Fixes
5+
* **iconfont:** 更改引入 iconfont 方式 ([e11f13c](https://github.com/ibwei/vue3-base/commit/e11f13cde660fa9c255616e7fd2978c32abdc178))
6+
* **less:** 更新 less 版本,兼容 antdv ([1f9c248](https://github.com/ibwei/vue3-base/commit/1f9c2488fa35fc4e8fe52229db48ca1f53813fb1))
7+
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
8+
* **types:** 更改部分 type 说明 ([89b0a19](https://github.com/ibwei/vue3-base/commit/89b0a193629576f49146d968460658c66e8e1895))
9+
* **vue3:** 更新到 vue3 正式版并修复错误 ([074b83a](https://github.com/ibwei/vue3-base/commit/074b83a8db7ed1f68d6fb4faf0f04302743a02c5))
10+
* **修复 ci/cd:** 修复 ([b078729](https://github.com/ibwei/vue3-base/commit/b078729d502d3d050b184fd02d8c42a9782f0182))
11+
* **关闭 prettier检查:** 关闭 ([c8b5d4f](https://github.com/ibwei/vue3-base/commit/c8b5d4fb8192b6e78d560a47cbd4630612b283a1))
12+
* **编辑器配置:** 更新vscode 编辑器配置 ([8858aee](https://github.com/ibwei/vue3-base/commit/8858aeebb60214cab5c740bd96a7f1c433fb93dd))
13+
14+
15+
### Features
16+
17+
* **ci/cd:** ci/cd ([2228fcc](https://github.com/ibwei/vue3-base/commit/2228fccb48d0aed7e3a0aee4d374d20a5c1bdc95))
18+
* **i18n:** 主要增加了国际化方案 ([7affdf8](https://github.com/ibwei/vue3-base/commit/7affdf821bf934e4fc364ab89bb9731475987141))
19+
* **layout 编写:** 完成 layout 编写,实现全屏切换方式 ([366d49c](https://github.com/ibwei/vue3-base/commit/366d49c9af6427b5a6ba11cd09df28e161457ec4))
20+
* **vuex:** 添加了 vuex 打印日志服务 ([badae42](https://github.com/ibwei/vue3-base/commit/badae42d9561fc155a45b152f496e2ca955a5532))
21+
* **完成 ci/cd配置:** 完成 CI/CD ([262d1b2](https://github.com/ibwei/vue3-base/commit/262d1b24a4c1c50824832f02619600cd03fa6c25))
22+
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))
23+
24+
25+
### Performance Improvements
26+
27+
* **插件:** 插件更新为自动化加载 ([e0d39c4](https://github.com/ibwei/vue3-base/commit/e0d39c43c81c21d50c250a9d833d9d012ff7a55b))
28+
29+
30+
31+
## [0.1.7](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.7) (2020-09-29)
32+
33+
34+
### Bug Fixes
35+
36+
* **less:** 更新 less 版本,兼容 antdv ([1f9c248](https://github.com/ibwei/vue3-base/commit/1f9c2488fa35fc4e8fe52229db48ca1f53813fb1))
37+
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
38+
* **types:** 更改部分 type 说明 ([89b0a19](https://github.com/ibwei/vue3-base/commit/89b0a193629576f49146d968460658c66e8e1895))
39+
* **vue3:** 更新到 vue3 正式版并修复错误 ([074b83a](https://github.com/ibwei/vue3-base/commit/074b83a8db7ed1f68d6fb4faf0f04302743a02c5))
40+
41+
42+
### Features
43+
44+
* **i18n:** 主要增加了国际化方案 ([7affdf8](https://github.com/ibwei/vue3-base/commit/7affdf821bf934e4fc364ab89bb9731475987141))
45+
* **vuex:** 添加了 vuex 打印日志服务 ([badae42](https://github.com/ibwei/vue3-base/commit/badae42d9561fc155a45b152f496e2ca955a5532))
46+
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))
47+
48+
49+
### Performance Improvements
50+
51+
* **插件:** 插件更新为自动化加载 ([e0d39c4](https://github.com/ibwei/vue3-base/commit/e0d39c43c81c21d50c250a9d833d9d012ff7a55b))
52+
53+
54+
55+
## [0.1.6](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.6) (2020-09-17)
56+
57+
58+
### Bug Fixes
59+
60+
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
61+
62+
63+
### Features
64+
65+
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))
66+
67+
68+
69+
## 0.1.5 (2020-09-09)
70+
71+
### Bug Fixes
72+
73+
- **修复提交工具:** 更改 git-cz 配置文件 ([372391f](https://github.com/ibwei/vue3-base/commit/372391f79e177c685277409ad873cd963c756ee3))
74+
75+
### Features
76+
77+
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 ([d4e8514](https://github.com/ibwei/vue3-base/commit/d4e851421b72b7f2ff273d8ebc72c08919b94392))
78+
- **完善 type:** 将第三方库的类型添加到每一个 vue 组件实例中去 ([13b84ab](https://github.com/ibwei/vue3-base/commit/13b84ab084ee388e114618db31ab801d28143bdf))
79+
- **补全基础代码:** 更换 types 位置,增加 layout 文件,修复 docs 文档,修改 tsconfig 配置等 ([d56645f](https://github.com/ibwei/vue3-base/commit/d56645fcf33959bcf57453690201be3cdd55620c))
80+
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 ([f3da208](https://github.com/ibwei/vue3-base/commit/f3da208fa7bcd9141c829327cf949aaf486a0ce7))
81+
82+
## 0.1.4 (2020-09-05)
83+
84+
### Bug Fixes
85+
86+
- **修复提交工具:** 更改 git-cz 配置文件 ([372391f](https://github.com/ibwei/vue3-base/commit/372391f79e177c685277409ad873cd963c756ee3))
87+
88+
### Features
89+
90+
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 ([d4e8514](https://github.com/ibwei/vue3-base/commit/d4e851421b72b7f2ff273d8ebc72c08919b94392))
91+
- **完善 type:** 将第三方库的类型添加到每一个 vue 组件实例中去 ([13b84ab](https://github.com/ibwei/vue3-base/commit/13b84ab084ee388e114618db31ab801d28143bdf))
92+
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 ([f3da208](https://github.com/ibwei/vue3-base/commit/f3da208fa7bcd9141c829327cf949aaf486a0ce7))
93+
94+
## 0.1.3 (2020-09-04)
95+
96+
### Bug Fixes
97+
98+
- **修复提交工具:** 更改 git-cz 配置文件 372391f
99+
100+
### Features
101+
102+
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
103+
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208
104+
105+
## 0.1.2 (2020-09-03)
106+
107+
### Features
108+
109+
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
110+
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208
111+
112+
## 0.1.1 (2020-09-03)
113+
114+
### Features
115+
116+
- **基础代码架构:** 项目基础代码初始化,目前只有 vue 全家桶 d4e8514
117+
- **项目搭建:** 初步完成除了 UI 库以外的基础配置 f3da208

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# 项目基础代码架构说明
22

3-
- <font color="red">目前暂时还未完成 vuex 的类型编写</font>
4-
53
#### 主要用到的库
64

75
- vue 全家桶 vue3 + vue-router + vuex + typescript
@@ -102,7 +100,7 @@
102100
#### 数据状态管理
103101

104102
- [x] 建立应用数据状态管理
105-
- [x] 编写更加建议读取的方法,并完善 type
103+
- [x] 编写更加简易读取的mutation方法,并完善 type 【新增】
106104
- [x] 支持多个模块,以及自动装载模块
107105
- [x] 支持持久化
108106

0 commit comments

Comments
 (0)