Skip to content

Commit 0cb0da0

Browse files
committed
vuex api 部分翻译
1 parent 338face commit 0cb0da0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/vuex/api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ const store = new Vuex.Store({ ...options })
1818

1919
- 类型: `Object`
2020

21-
Vuex store 的根状态对象
21+
Vuex store 的根state对象
2222

2323
[Details](state.md)
2424

2525
- **mutations**
2626

2727
- 类型: `{ [type: string]: Function }`
2828

29-
在 store 上注册 mutation,处理器方法总是接收 state 作为第一个参数(如果定义在模块中,则作为模块的本地状态),如果有则接收 payload 作为第二个参数。
29+
在 store 上注册 mutation,Handler function总是接收 state 作为第一个参数(如果定义在模块中,则作为模块的本地状态),如果有则接收 payload 作为第二个参数。
3030

3131
[详细介绍](mutations.md)
3232

3333
- **actions**
3434

35-
- 类型: `{ [类型: string]: Function }`
35+
- 类型: `{ [type: string]: Function }`
3636

37-
在 store 上注册 action。处理器方法接收一个 context 对象,提供一下属性
37+
在 store 上注册 action。Handler function接收一个 context 对象,这个对象提供以下属性
3838

3939
``` js
4040
{
@@ -59,15 +59,15 @@ const store = new Vuex.Store({ ...options })
5959
getters, // 等同于 store.getters
6060
rootState // 等同于 store.state
6161
```
62-
注册的 getter 暴露在 store.getters
62+
注册的 getter 被暴露在 store.getters
6363

6464
[详细介绍](getters.md)
6565

6666
- **modules**
6767

6868
- 类型: `Object`
6969

70-
包含了子模块的对象,会被融合到 store,大概长这样
70+
包含了子模块的对象,会被合并到 store,形如
7171

7272
``` js
7373
{
@@ -82,15 +82,15 @@ const store = new Vuex.Store({ ...options })
8282
}
8383
```
8484

85-
就像根模块的配置,每个模块包含 state 和 mutations,模块的状态使用模块的 key 关联到 store 的根状态。模块的 mutation 和 getter 将接收 module 的本地状态作为第一个参数,而不是根状态,并且模块 action 的 context.state 同样指向本地状态
85+
每个模块可以包含 state 和 mutations,就像根模块的配置。一个模块的状态使用模块的 key 附加到 store 的根状态上。模块的 mutation 和 getter 将接收 module 的本地状态作为第一个参数,而不是根状态,并且模块 action 的 context.state 也指向本地状态
8686

8787
[详细介绍](modules.md)
8888

8989
- **plugins**
9090

9191
- 类型: `Array<Function>`
9292

93-
一个数组,包含应用在 store 上的插件方法。这些插件直接接收 store 作为唯一参数,可以监听 mutation(用于外部地数据持久化、记录或调试)或者提交 mutation (用于内部数据,例如 websocket 或 某些观察者)。
93+
一个插件方法的数组被应用于 store 。这些插件直接接收 store 作为唯一参数,也可以监听 mutation(用于外部地数据持久化、记录或调试)或者提交 mutation (用于内部数据,例如 websocket 或 某些观察者)。
9494

9595
[详细介绍](plugins.md)
9696

@@ -133,7 +133,7 @@ const store = new Vuex.Store({ ...options })
133133

134134
- **`watch(getter: Function, cb: Function, options?: Object)`**
135135

136-
响应式的监测一个 getter 方法的返回值,当值改变时调用回调。getter 接收 store 的状态作为唯一参数。接收一个可选的对象参数表示 Vue 的 vm.$watch 方法的参数
136+
响应式的监测一个 getter 方法的返回值,当值改变时调用回调。getter 接收 store 的 state 作为唯一参数。接收类似 vm.$watch 方法的参数的可选对象
137137

138138
要停止检测,调用该方法的返回值 (watch 的返回值是个方法)。
139139

@@ -152,15 +152,15 @@ const store = new Vuex.Store({ ...options })
152152

153153
- **`registerModule(path: string | Array<string>, module: Module)`**
154154

155-
动态注册一个模块。 [详细介绍](modules.md#dynamic-module-registration)
155+
注册一个动态模块。 [详细介绍](modules.md#dynamic-module-registration)
156156

157157
- **`unregisterModule(path: string | Array<string>)`**
158158

159-
移除一个注册的模块。 [详细介绍](modules.md#dynamic-module-registration)
159+
注销一个动态模块。 [详细介绍](modules.md#dynamic-module-registration)
160160

161161
- **`hotUpdate(newOptions: Object)`**
162162

163-
移除一个注册的模块。 [详细介绍](hot-reload.md)
163+
热加载新的 action 和 mutation。 [详细介绍](hot-reload.md)
164164

165165
### 组件绑定助手
166166

0 commit comments

Comments
 (0)