LoginSignup
4
2

More than 3 years have passed since last update.

【Vue.js】transitionのin-outとout-inの表示結果デモ

Posted at

はじめに

Vue.jsのtransitionタグの属性であるin-outout-inの動きの違いが分かるデモを作ってみました。

公式ドキュメントはこちら。

環境

- OS: macOS Catalina 10.15.1
- Vue: 2.6.10

基本構文

<transition mode="out-in">
  <!-- ... the buttons ... -->
</transition>

このmodeの値をin-outout-inどちらにするかで表示が変わります。

指定なし

See the Pen LYERjdZ by terufumi (@terufumi1122) on CodePen.

in-out

最初に新しい要素がトランジションして、それが完了したら、現在の要素がトランジションアウトする。

See the Pen wvBzPJG by terufumi (@terufumi1122) on CodePen.

out-in

最初に現在の要素がトランジションアウトして、それが完了したら、新しい要素がトランジションインする。

See the Pen XWJjzME by terufumi (@terufumi1122) on CodePen.

おわりに

最後まで読んで頂きありがとうございました:bow_tone1:

特に意図が無ければout-inを指定しておくのが無難ですね:thinking:

参考にさせて頂いたサイト(いつもありがとうございます)

Enter/Leave とトランジション一覧 — Vue.js

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2