Skip to content

Commit 48945da

Browse files
committed
translate pipeline/data.md
1 parent 32111da commit 48945da

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/ja/pipeline/data.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
# `data(transition) [-> Promise]`
22

3-
Called on an incoming component during the activation phase, after the `activate` hook has been resolved. Load and set data on the current component.
3+
`activate` フックが解決された後、活性化フェーズの間に入ってくるコンポーネントに呼び出されます。ロードして現在のコンポーネントでデータを設定します。
44

5-
### Arguments
5+
### 引数
66

77
- [`transition {Transition}`](hooks.md#transition-object)
88

9-
Calling `transition.next(data)` will set each property in `data` on the component. For example, with `{ a: 1, b: 2 }`, the router will call `component.$set('a', 1)` and `component.$set('b', 2)`.
9+
`transition.next(data)` の呼び出しはコンポーネントの `data` にプロパティ毎に設定します。例えば `{ a: 1, b: 2 }` が引数に指定される場合、ルーターは `component.$set('a', 1)` `component.$set('b', 2)` を呼びます。
1010

11-
### Return Value
11+
### 戻り値
1212

13-
- optionally return a Promise.
13+
- 任意で Promise を返す。
1414
- `resolve(data)` -> `transition.next(data)`
1515
- `reject(reason)` -> `transition.abort(reason)`
1616

17-
### Details
17+
### 詳細
1818

19-
The `data` transition hook is called immediately after the `activate` hook is resolved, and right before the view switching is executed. The entering component gets a **`$loadingRouteData`** meta property, which starts with value `false` and set to `true` when the `data` hook is resolved. This property can be used to display a loading state for the entering component.
19+
`data` トランジションフックは、`activate` フックが解決された直後に呼び出され、直前に view の切り替えが実行されます。entering なコンポーネントは、**`$loadingRouteData`** メタプロパティを取得します。そのプロパティは `false` 値で開始し、`data` フックが解決されるとき、`true` に設定します。このプロパティは entering なコンポーネントに対してローディング状態を表示するために使用することができます。
2020

21-
The `data` hook is different from `activate` in that:
21+
`data` フックは `activate` とは以下が異なります:
2222

23-
1. `data` is also called every time the route changes, even if the current component is reused, while `activate` is only called when component is newly created.
23+
1. たとえ現状のコンポーネントが再利用される場合でも、`data` は毎回 route が変更する度に呼ばれるのに対し、`activate` はコンポーネントが新しく作成されるときだけ呼ばれます。
2424

25-
Imagine we have a component for the route `/message/:id`, and we are currently on `/message/1`. When the user navigates to `/message/2`, the current component can be reused, so the `activate` hook will not get called. But we do want to fetch and update the data based on the new `id` param, so in most cases it makes sense to do data fetching in `data` instead of `activate`.
25+
route `/message/:id` に対してコンポーネントがあり、現在 `/message/1` のパスであると想像してください。ユーザーが `/message/2` にナビゲートするとき、現状のコンポーネントは再利用できますが、`activate` フックは呼ばれません。しかし、フェッチしたくて新しい `id` パラメータに基づいたデータを更新したい場合、ほとんどの場合は `activate` の代わりに `data` でデータをフェッチするのは道理にかないます。
2626

27-
2. `activate`'s responsibility is controlling the timing of switching to the new component. In comparison, `data` is called right after `activate` is resolved and right before the view switching happens, so the data fetching and the new component's entering animation will go in parallel, and the component will be in a "loading" state before `data` is resolved.
27+
2. `activate` の債務は新しいコンポーネントへの切り替えのタイミングを制御しています。比較して、`data` `activate` が解決される直後と view の切り替えが起こる直前に呼びされるため、データのフェッチと新しいコンポーネントが入ってくるアニメーションは並行して行い、`data` が解決される前に "loading" 状態になります。
2828

29-
Let's consider the difference in the User Experience here:
29+
それではここでユーザーエクスペリエンスの違いを考えてみましょう:
3030

31-
- If we wait for the data to be fetched before displaying the new component, the user will feel like the interface is "stuck" for a split second before the view switches.
31+
- もし新しいコンポーネントを表示する前にデータがフェッチされるまで待つ場合は、ユーザーはインターフェイスが view の切り替え前に一瞬 "行き詰まらせる" ような感じになります。
3232

33-
- Instead, we can react to user input instantly and start switching the view, while displaying the new component with a "loading" state. If we have a CSS transition in between, the animation time can overlap nicely with the data wait time.
33+
- 代わりに、"loading" 状態で新しいコンポーネントを表示している間、すぐにユーザー入力に反応し view の切り替えを開始することができます。もし合間で CSS トランジションを使用している場合、アニメーション時間はデータ待ち時間とうまく重なり合うことができます。
3434

35-
With that said, if you still wish to wait until data is loaded before switching the view, you can add **`waitForData: true`** inside your component's `route` option.
35+
そうは言っても、view を切り替える前、データがロードされるまでにまだ待つのを希望するならば、あなたのコンポーネントの `route` オプション内部で **`waitfordata: true`** を追加することができます。
3636

37-
### Examples
37+
###
3838

39-
By calling `transition.next`:
39+
`transition.next` 呼び出すことによって:
4040

4141
``` js
4242
route: {
@@ -50,7 +50,7 @@ route: {
5050
}
5151
```
5252

53-
By returning a Promise:
53+
Promise を返すことによって:
5454

5555
``` js
5656
route: {
@@ -64,7 +64,7 @@ route: {
6464
}
6565
```
6666

67-
Parallel requests, with Promise & ES6:
67+
Promise & ES6 で並行なリクエスト:
6868

6969
``` js
7070
route: {
@@ -77,7 +77,7 @@ route: {
7777
}
7878
```
7979

80-
Equivalent of above in ES5:
80+
ES5 による上記と等価:
8181

8282
``` js
8383
route: {
@@ -96,7 +96,7 @@ route: {
9696
}
9797
```
9898

99-
Using `$loadingRouteData` in templates:
99+
テンプレートで `loadingRouteData` を使用する:
100100

101101
``` html
102102
<div class="view">

0 commit comments

Comments
 (0)