File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ actions: {
158
158
}
159
159
```
160
160
161
- 最后,如果我们利用 [ async / await] ( https://tc39.github.io/ecmascript-asyncawait/ ) 这个 JavaScript 即将到来的新特性,我们可以像这样组合 action:
161
+ 最后,如果我们利用 [ async / await] ( https://tc39.github.io/ecmascript-asyncawait/ ) ,我们可以如下组合 action:
162
162
163
163
``` js
164
164
// 假设 getData() 和 getOtherData() 返回的是 Promise
Original file line number Diff line number Diff line change @@ -36,11 +36,12 @@ const store = new Vuex.Store({ ...options })
36
36
37
37
``` js
38
38
{
39
- state, // 等同于 store.state, 若在模块中则为局部状态
40
- rootState, // 等同于 store.state, 只存在于模块中
41
- commit, // 等同于 store.commit
42
- dispatch, // 等同于 store.dispatch
43
- getters // 等同于 store.getters
39
+ state, // 等同于 `store.state`,若在模块中则为局部状态
40
+ rootState, // 等同于 `store.state`,只存在于模块中
41
+ commit, // 等同于 `store.commit`
42
+ dispatch, // 等同于 `store.dispatch`
43
+ getters, // 等同于 `store.getters`
44
+ rootGetters // 等同于 `store.getters`,只存在于模块中
44
45
}
45
46
```
46
47
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ computed: {
68
68
``` js
69
69
getters: {
70
70
// ...
71
- getTodoById : (state , getters ) => (id ) => {
71
+ getTodoById : (state ) => (id ) => {
72
72
return state .todos .find (todo => todo .id === id)
73
73
}
74
74
}
You can’t perform that action at this time.
0 commit comments