@@ -18,23 +18,23 @@ const store = new Vuex.Store({ ...options })
18
18
19
19
- 类型: ` Object `
20
20
21
- Vuex store 的根状态对象 。
21
+ Vuex store 的根state对象 。
22
22
23
23
[ Details] ( state.md )
24
24
25
25
- ** mutations**
26
26
27
27
- 类型: ` { [type: string]: Function } `
28
28
29
- 在 store 上注册 mutation,处理器方法总是接收 state 作为第一个参数(如果定义在模块中,则作为模块的本地状态),如果有则接收 payload 作为第二个参数。
29
+ 在 store 上注册 mutation,Handler function总是接收 state 作为第一个参数(如果定义在模块中,则作为模块的本地状态),如果有则接收 payload 作为第二个参数。
30
30
31
31
[ 详细介绍] ( mutations.md )
32
32
33
33
- ** actions**
34
34
35
- - 类型: ` { [类型: string]: Function } `
35
+ - 类型: ` { [type: string]: Function } `
36
36
37
- 在 store 上注册 action。处理器方法接收一个 context 对象,提供一下属性 :
37
+ 在 store 上注册 action。Handler function接收一个 context 对象,这个对象提供以下属性 :
38
38
39
39
``` js
40
40
{
@@ -59,15 +59,15 @@ const store = new Vuex.Store({ ...options })
59
59
getters, // 等同于 store.getters
60
60
rootState // 等同于 store.state
61
61
```
62
- 注册的 getter 暴露在 store .getters 。
62
+ 注册的 getter 被暴露在 store .getters 。
63
63
64
64
[详细介绍](getters .md )
65
65
66
66
- ** modules**
67
67
68
68
- 类型: ` Object`
69
69
70
- 包含了子模块的对象,会被融合到 store,大概长这样 :
70
+ 包含了子模块的对象,会被合并到 store,形如 :
71
71
72
72
` ` ` js
73
73
{
@@ -82,15 +82,15 @@ const store = new Vuex.Store({ ...options })
82
82
}
83
83
` ` `
84
84
85
- 就像根模块的配置,每个模块包含 state 和 mutations,模块的状态使用模块的 key 关联到 store 的根状态 。模块的 mutation 和 getter 将接收 module 的本地状态作为第一个参数,而不是根状态,并且模块 action 的 context .state 同样指向本地状态 。
85
+ 每个模块可以包含 state 和 mutations,就像根模块的配置。一个模块的状态使用模块的 key 附加到 store 的根状态上 。模块的 mutation 和 getter 将接收 module 的本地状态作为第一个参数,而不是根状态,并且模块 action 的 context .state 也指向本地状态 。
86
86
87
87
[详细介绍](modules .md )
88
88
89
89
- ** plugins**
90
90
91
91
- 类型: ` Array<Function>`
92
92
93
- 一个数组,包含应用在 store 上的插件方法 。这些插件直接接收 store 作为唯一参数,可以监听 mutation(用于外部地数据持久化、记录或调试)或者提交 mutation (用于内部数据,例如 websocket 或 某些观察者)。
93
+ 一个插件方法的数组被应用于 store 上 。这些插件直接接收 store 作为唯一参数,也可以监听 mutation(用于外部地数据持久化、记录或调试)或者提交 mutation (用于内部数据,例如 websocket 或 某些观察者)。
94
94
95
95
[详细介绍](plugins .md )
96
96
@@ -133,7 +133,7 @@ const store = new Vuex.Store({ ...options })
133
133
134
134
- ** ` watch(getter: Function, cb: Function, options?: Object)` **
135
135
136
- 响应式的监测一个 getter 方法的返回值,当值改变时调用回调。getter 接收 store 的状态作为唯一参数。接收一个可选的对象参数表示 Vue 的 vm .$watch 方法的参数 。
136
+ 响应式的监测一个 getter 方法的返回值,当值改变时调用回调。getter 接收 store 的 state 作为唯一参数。接收类似 vm .$watch 方法的参数的可选对象 。
137
137
138
138
要停止检测,调用该方法的返回值 (watch 的返回值是个方法)。
139
139
@@ -152,15 +152,15 @@ const store = new Vuex.Store({ ...options })
152
152
153
153
- ** ` registerModule(path: string | Array<string>, module: Module)` **
154
154
155
- 动态注册一个模块 。 [详细介绍](modules .md #dynamic- module - registration)
155
+ 注册一个动态模块 。 [详细介绍](modules .md #dynamic- module - registration)
156
156
157
157
- ** ` unregisterModule(path: string | Array<string>)` **
158
158
159
- 移除一个注册的模块 。 [详细介绍](modules .md #dynamic- module - registration)
159
+ 注销一个动态模块 。 [详细介绍](modules .md #dynamic- module - registration)
160
160
161
161
- ** ` hotUpdate(newOptions: Object)` **
162
162
163
- 移除一个注册的模块 。 [详细介绍](hot- reload .md )
163
+ 热加载新的 action 和 mutation 。 [详细介绍](hot- reload .md )
164
164
165
165
### 组件绑定助手
166
166
0 commit comments