Skip to content

Commit

Permalink
docs(zh): update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinjiang committed Feb 18, 2019
1 parent 31e4fbc commit 1fd2fc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/zh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ new Vue({

另外,通过定义和隔离状态管理中的各种概念并强制遵守一定的规则,我们的代码将会变得更结构化且易维护。

这就是 Vuex 背后的基本思想,借鉴了 [Flux](https://facebook.github.io/flux/docs/overview.html)[Redux](http://redux.js.org/)[The Elm Architecture](https://guide.elm-lang.org/architecture/)。与其他模式不同的是,Vuex 是专门为 Vue.js 设计的状态管理库,以利用 Vue.js 的细粒度数据响应机制来进行高效的状态更新。
这就是 Vuex 背后的基本思想,借鉴了 [Flux](https://facebook.github.io/flux/docs/overview.html)[Redux](http://redux.js.org/) [The Elm Architecture](https://guide.elm-lang.org/architecture/)。与其他模式不同的是,Vuex 是专门为 Vue.js 设计的状态管理库,以利用 Vue.js 的细粒度数据响应机制来进行高效的状态更新。

![vuex](/vuex.png)

Expand Down
4 changes: 4 additions & 0 deletions docs/zh/guide/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,12 @@ store.registerModule(['nested', 'myModule'], {

你也可以使用 `store.unregisterModule(moduleName)` 来动态卸载模块。注意,你不能使用此方法卸载静态模块(即创建 store 时声明的模块)。

#### 保留 state

在注册一个新 module 时,你很有可能想保留过去的 state,例如从一个服务端渲染的应用保留 state。你可以通过 `preserveState` 选项将其归档:`store.registerModule('a', module, { preserveState: true })`

当你设置 `preserveState: true` 时,该模块会被注册,action、mutation 和 getter 会被添加到 store 中,但是 state 不会。这里假设 store 的 state 已经包含了这个 module 的 state 并且你不希望将其覆写。

### 模块重用

有时我们可能需要创建一个模块的多个实例,例如:
Expand Down

0 comments on commit 1fd2fc4

Please sign in to comment.