Skip to content

Commit 29e0a63

Browse files
committed
热加载翻译
1 parent 4997b61 commit 29e0a63

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/vuex/hot-reload.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ type: vuex
44
order: 14
55
---
66

7-
Vuex supports hot-reloading mutations, modules, actions and getters during development, using Webpack's [Hot Module Replacement API](https://webpack.github.io/docs/hot-module-replacement.html). You can also use it in Browserify with the [browserify-hmr](https://github.com/AgentME/browserify-hmr/) plugin.
7+
Vuex 支持在开发中使用webpack的[Hot Module Replacement API](https://webpack.github.io/docs/hot-module-replacement.html) 热重载 mutations,modules ,actions 和 getters,你也可以在 Browserify 里使用 [browserify-hmr](https://github.com/AgentME/browserify-hmr/) 插件来实现同样的功能。
88

9-
For mutations and modules, you need to use the `store.hotUpdate()` API method:
9+
对于mutations 和 modules,你只需要简单地调用 store.hotUpdate():
1010

1111
``` js
1212
// store.js
@@ -28,13 +28,13 @@ const store = new Vuex.Store({
2828
})
2929

3030
if (module.hot) {
31-
// accept actions and mutations as hot modules
31+
// 使 actions mutations 成为可热重载模块
3232
module.hot.accept(['./mutations', './modules/a'], () => {
33-
// require the updated modules
34-
// have to add .default here due to babel 6 module output
33+
// 获取更新后的模块
34+
// 因为 babel 6 的模块编译格式问题,这里需要加上 .default
3535
const newMutations = require('./mutations').default
3636
const newModuleA = require('./modules/a').default
37-
// swap in the new actions and mutations
37+
// 成新的 mutation 和 mudule
3838
store.hotUpdate({
3939
mutations: newMutations,
4040
modules: {
@@ -45,4 +45,4 @@ if (module.hot) {
4545
}
4646
```
4747

48-
Checkout the [counter-hot example](https://github.com/vuejs/vuex/tree/dev/examples/counter-hot) to play with hot-reload.
48+
查看[热加载的例子](https://github.com/vuejs/vuex/tree/dev/examples/counter-hot) 来开始使用热加载

0 commit comments

Comments
 (0)