Skip to content

Commit d28220c

Browse files
committed
docs: [ja] add custome fields translation
1 parent 802d743 commit d28220c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/ja/route.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@ route オブジェクトは以下のプロパティを公開します:
2020

2121
この route (そしてそのオーナー自身のコンポーネント) を管理しているルーターインスタンス。
2222

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+
``` js
39+
router.beforeEach(function (transition) {
40+
if (transition.to.auth) {
41+
// 認証する...
42+
}
43+
})
44+
```
45+
46+
ネストされた route がマッチされるとき、全てのカスタムフィールドは同じ `$route` オブジェクトにマージされます。サブ route と 親 route が同じカスタムフィールドを持っているとき、サブ route の値は親の値で上書きされます。
47+
2348
### テンプレートでの使用
2449

2550
あなたのコンポーネントのテンプレート内部で、直接 `$route` オブジェクトにバインドできます。例えば:

0 commit comments

Comments
 (0)