Skip to content

Commit e31ea69

Browse files
committed
doc(ja): Translate JavaScript Hooks section in transition-enterleave page
1 parent c0f9769 commit e31ea69

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/guide/transitions-enterleave.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -258,33 +258,32 @@ Vue.createApp(Demo).mount('#demo')
258258

259259
### Using Transitions and Animations Together
260260

261-
Vue needs to attach event listeners in order to know when a transition has ended. It can either be `transitionend` or `animationend`, depending on the type of CSS rules applied. If you are only using one or the other, Vue can automatically detect the correct type.
262-
263-
However, in some cases you may want to have both on the same element, for example having a CSS animation triggered by Vue, along with a CSS transition effect on hover. In these cases, you will have to explicitly declare the type you want Vue to care about in a `type` attribute, with a value of either `animation` or `transition`.
261+
Vue はトランジションが終了したことを把握するためのイベントリスナのアタッチを必要とします。イベントは、適用される CSS ルールに応じて `transitionend``animationend` のいずれかのタイプになります。あなたがトランジションとアニメーション、どちらか一方だけ使用する場合は、Vue は自動的に正しいタイプを判断することができます。
264262

263+
しかし、例えば、ホバーの CSS トランジション効果と Vue による CSS アニメーションのトリガの両方を持つ場合など、時には、同じ要素に両方を使うこともあるかもしれません。これらのケースでは、Vue に扱って欲しいタイプを `type` 属性で明示的に宣言するべきでしょう。この属性の値は、`animation` あるいは `transition` を取ります。
265264
### Explicit Transition Durations
266265

267266
TODO: validate and provide an example
268267

269-
> New in 2.2.0+
268+
> 2.2.0 から新規追加
270269
271-
In most cases, Vue can automatically figure out when the transition has finished. By default, Vue waits for the first `transitionend` or `animationend` event on the root transition element. However, this may not always be desired - for example, we may have a choreographed transition sequence where some nested inner elements have a delayed transition or a longer transition duration than the root transition element.
270+
ほとんどの場合、 Vue は、自動的にトランジションが終了したことを見つけ出すことは可能です。デフォルトでは、 Vue はルート要素の初めの `transitionend` もしくは `animationend` イベントを待ちます。しかし、これが常に望む形とは限りません。例えば、幾つかの入れ子となっている内部要素にてトランジションの遅延がある場合や、ルートのトランジション要素よりも非常に長いトランジション期間を設けている場合の、一連のトランジションのまとまりなどです。
272271

273-
In such cases you can specify an explicit transition duration (in milliseconds) using the `duration` prop on the `<transition>` component:
272+
このような場合 `<transition>` コンポーネントがもつ `duration` プロパティを利用することで、明示的に遷移にかかる時間(ミリ秒単位)を指定することが可能です:
274273

275274
```html
276275
<transition :duration="1000">...</transition>
277276
```
278277

279-
You can also specify separate values for enter and leave durations:
278+
また、活性化時と終了時の期間を、個別に指定することも可能です:
280279

281280
```html
282281
<transition :duration="{ enter: 500, leave: 800 }">...</transition>
283282
```
284283

285284
### JavaScript Hooks
286285

287-
You can also define JavaScript hooks in attributes:
286+
属性によって JavaScript フックを定義することができます:
288287

289288
```html
290289
<transition
@@ -312,8 +311,7 @@ methods: {
312311
beforeEnter(el) {
313312
// ...
314313
},
315-
// the done callback is optional when
316-
// used in combination with CSS
314+
// CSS と組み合わせて使う時、done コールバックはオプションです
317315
enter(el, done) {
318316
// ...
319317
done()
@@ -332,27 +330,26 @@ methods: {
332330
beforeLeave(el) {
333331
// ...
334332
},
335-
// the done callback is optional when
336-
// used in combination with CSS
333+
// CSS と組み合わせて使う時、done コールバックはオプションです
337334
leave(el, done) {
338335
// ...
339336
done()
340337
},
341338
afterLeave(el) {
342339
// ...
343340
},
344-
// leaveCancelled only available with v-show
341+
// v-show と共に使うときだけ leaveCancelled は有効です
345342
leaveCancelled(el) {
346343
// ...
347344
}
348345
}
349346
```
350347

351-
These hooks can be used in combination with CSS transitions/animations or on their own.
348+
これらのフックは、CSS トランジション/アニメーション、または別の何かと組み合わせて使うことができます。
352349

353-
When using JavaScript-only transitions, **the `done` callbacks are required for the `enter` and `leave` hooks**. Otherwise, the hooks will be called synchronously and the transition will finish immediately. Adding `:css="false"` will also let know Vue to skip CSS detection. Aside from being slightly more performant, this also prevents CSS rules from accidentally interfering with the transition.
350+
JavaScript のみを利用したトランジションの場合は、**`done` コールバックを `enter` `leave` フックで呼ぶ必要があります**。呼ばない場合は、フックは同期的に呼ばれ、トランジションはただちに終了します。また、 `:css="false"` を追加することで、CSS の検出をスキップすることを Vue に伝えられます。これによってわずかにパフォーマンスが改善するほか、CSS のルールの誤ったトランジションへの干渉を防ぐことができます。
354351

355-
Now let's dive into an example. Here's a JavaScript transition using [GreenSock](https://greensock.com/):
352+
今から例をみていきましょう。これは [GreenSock](https://greensock.com/) を使ったシンプルな JavaScript トランジションの例です:
356353

357354
```html
358355
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.4/gsap.min.js"></script>

0 commit comments

Comments
 (0)