File tree Expand file tree Collapse file tree 5 files changed +43
-2
lines changed
Expand file tree Collapse file tree 5 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 99- [ インストール] ( installation.md )
1010- [ Vuex とは何か?] ( intro.md )
1111- [ Vuex 入門] ( getting-started.md )
12- - コアコンセプト
12+ - [ コアコンセプト] ( core-concepts.md )
1313 - [ ステート] ( state.md )
1414 - [ ゲッター] ( getters.md )
1515 - [ ミューテーション] ( mutations.md )
Original file line number Diff line number Diff line change @@ -193,3 +193,7 @@ const store = new Vuex.Store({ ...options })
193193 ミューテーションをコミットするコンポーネントの methods オプションを作成します。[詳細](mutations .md #commiting- mutations- in - components)
194194
195195 第1 引数は、オプションで名前空間文字列にすることができます。[詳細](modules .md #binding- helpers- with - namespace)
196+
197+ - ** ` createNamespacedHelpers(namespace: string): Object` **
198+
199+ 名前空間付けられたコンポーネントバインディングのヘルパーを作成します。返されるオブジェクトは指定された名前空間にバインドされた ` mapState` 、` mapGetters` 、` mapActions` そして ` mapMutations` が含まれます。[詳細はこちら](modules .md #binding- helpers- with - namespace)
Original file line number Diff line number Diff line change 1+ # コアコンセプト
2+
3+ この章では、Vuex のコアコンセプトについて、以下を学習します。
4+ - [ ステート] ( state.md )
5+ - [ ゲッター] ( getters.md )
6+ - [ ミューテーション] ( mutations.md )
7+ - [ アクション] ( actions.md )
8+ - [ モジュール] ( modules.md )
9+
10+ これらのコンセプトを深く理解することは、Vuex を使用するにあたって不可欠です。
11+
12+ それでは、始めましょう!
Original file line number Diff line number Diff line change @@ -206,6 +206,31 @@ methods: {
206206}
207207```
208208
209+ さらに、` createNamespacedHelpers ` を使用することによって名前空間付けされたヘルパーを作成できます。指定された名前空間の値にバインドされた新しいコンポーネントバインディングヘルパーを持つオブジェクトを返します:
210+
211+ ``` js
212+ import { createNamespacedHelpers } from ' vuex'
213+
214+ const { mapState , mapActions } = createNamespacedHelpers (' some/nested/module' )
215+
216+ export default {
217+ computed: {
218+ // `some/nested/module` を調べます
219+ ... mapState ({
220+ a : state => state .a ,
221+ b : state => state .b
222+ })
223+ },
224+ methods: {
225+ // `some/nested/module` を調べます
226+ ... mapActions ([
227+ ' foo' ,
228+ ' bar'
229+ ])
230+ }
231+ }
232+ ```
233+
209234#### プラグイン開発者向けの注意事項
210235
211236モジュールを提供する[ プラグイン] ( plugins.md ) を作成し、ユーザーがそれらを Vuex ストアに追加できるようにすると、モジュールの予測できない名前空間が気になるかもしれません。あなたのモジュールは、プラグインユーザーが名前空間付きモジュールの元にモジュールを追加すると、その名前空間に属するようになります。この状況に適応するには、プラグインオプションを使用して名前空間の値を受け取る必要があります。
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ const Counter = {
5757
5858### ` mapState ` ヘルパー
5959
60- コンポーネントが複数のストアのステートプロパティやゲッターを必要としているとき、これらすべてにおいて、算出プロパティを宣言することは繰り返しで冗長です。これに対処するため、算出ゲッター関数を生成し、いくつかのキーストロークを節約するのに役立つ ` mapState ` ヘルパーを使うことができます:
60+ コンポーネントが複数のストアのステートプロパティやゲッターを必要としているとき、これらすべてにおいて、算出プロパティを宣言することは繰り返しで冗長です。これに対処するため、算出ゲッター関数を生成し、いくつかのキーストロークを省くのに役立つ ` mapState ` ヘルパーを使うことができます:
6161
6262``` js
6363// 完全ビルドでは、ヘルパーは Vuex.mapState として公開されています
You can’t perform that action at this time.
0 commit comments