0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Vue.jsのtransitionにはCSSとJSフックがある

Last updated at Posted at 2022-01-25

環境:Vue2・Vue3

Vue.jsでtransitionタグやtransition-groupタグを使用してアニメーションを実装する場合、
CSSのクラスを使用する方法とJavaScriptフックを使用する方法がある。

1.CSSクラスを使用する場合

Vueが用意してくれているcssクラスを使用する。
詳細は公式を確認お願いします。

2.Jsフックを使用する場合

Vueが用意してくれている関数等を使用する。
詳細は公式を確認お願いします。

どちらを使えばいいか

単純にCSSだけを使用するなら"1.CSSクラスを使用する場合"で問題ないと思われるが
もし「getBoundingClientRect()を使用して要素の高さを取得してからその数値を元に処理したい」など
jsの関数を使った処理が必要になる場合等はjsフックを使ったほうがシンプルに実装できそう。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?