Skip to content

Commit bd4fcc4

Browse files
authored
Merge pull request #146 from menpuji/2.0-cn
热重载 翻译
2 parents e75e89e + 6fbee66 commit bd4fcc4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vuex/hot-reload.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: 热加载
2+
title: 热重载
33
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)