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 9
9
- [ インストール] ( installation.md )
10
10
- [ Vuex とは何か?] ( intro.md )
11
11
- [ Vuex 入門] ( getting-started.md )
12
- - コアコンセプト
12
+ - [ コアコンセプト] ( core-concepts.md )
13
13
- [ ステート] ( state.md )
14
14
- [ ゲッター] ( getters.md )
15
15
- [ ミューテーション] ( mutations.md )
Original file line number Diff line number Diff line change @@ -193,3 +193,7 @@ const store = new Vuex.Store({ ...options })
193
193
ミューテーションをコミットするコンポーネントの methods オプションを作成します。[詳細](mutations .md #commiting- mutations- in - components)
194
194
195
195
第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: {
206
206
}
207
207
```
208
208
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
+
209
234
#### プラグイン開発者向けの注意事項
210
235
211
236
モジュールを提供する[ プラグイン] ( plugins.md ) を作成し、ユーザーがそれらを Vuex ストアに追加できるようにすると、モジュールの予測できない名前空間が気になるかもしれません。あなたのモジュールは、プラグインユーザーが名前空間付きモジュールの元にモジュールを追加すると、その名前空間に属するようになります。この状況に適応するには、プラグインオプションを使用して名前空間の値を受け取る必要があります。
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ const Counter = {
57
57
58
58
### ` mapState ` ヘルパー
59
59
60
- コンポーネントが複数のストアのステートプロパティやゲッターを必要としているとき、これらすべてにおいて、算出プロパティを宣言することは繰り返しで冗長です。これに対処するため、算出ゲッター関数を生成し、いくつかのキーストロークを節約するのに役立つ ` mapState ` ヘルパーを使うことができます:
60
+ コンポーネントが複数のストアのステートプロパティやゲッターを必要としているとき、これらすべてにおいて、算出プロパティを宣言することは繰り返しで冗長です。これに対処するため、算出ゲッター関数を生成し、いくつかのキーストロークを省くのに役立つ ` mapState ` ヘルパーを使うことができます:
61
61
62
62
``` js
63
63
// 完全ビルドでは、ヘルパーは Vuex.mapState として公開されています
You can’t perform that action at this time.
0 commit comments