We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 802d743 commit d28220cCopy full SHA for d28220c
docs/ja/route.md
@@ -20,6 +20,31 @@ route オブジェクトは以下のプロパティを公開します:
20
21
この route (そしてそのオーナー自身のコンポーネント) を管理しているルーターインスタンス。
22
23
+### カスタムフィールド
24
+
25
+上記のビルドインプロパティに加えて、route 設定で定義されたカスタムフィールドも、route オブジェクトにマージされます。例:
26
27
+``` js
28
+router.map({
29
+ '/a': {
30
+ component: { ... },
31
+ auth: true
32
+ }
33
+})
34
+```
35
36
+`/a` がマッチされるとき、`$route.auth` は `true` になります。これはグローバルフックで認証チェックを実行することができます:
37
38
39
+router.beforeEach(function (transition) {
40
+ if (transition.to.auth) {
41
+ // 認証する...
42
43
44
45
46
+ネストされた route がマッチされるとき、全てのカスタムフィールドは同じ `$route` オブジェクトにマージされます。サブ route と 親 route が同じカスタムフィールドを持っているとき、サブ route の値は親の値で上書きされます。
47
48
### テンプレートでの使用
49
50
あなたのコンポーネントのテンプレート内部で、直接 `$route` オブジェクトにバインドできます。例えば:
0 commit comments