1
0

More than 1 year has passed since last update.

Vue.jsで、リスト表示順の入れ替え処理を実装

Last updated at Posted at 2023-07-30

結論

コンポーネントに表示させる項目を格納した配列を用意しておきます。入れ替えは用意しておいた配列の要素同士を入れ替える関数を作成すればOKです。その関数を実行すると、要素入れ替えのあと再レンダリングがかかり、リストの表示順が入れ替わったように見えます。

前提

  • この記事ではCDN の Vue を使用しています。
  • vue@3.3.4を使用しています

サンプルコード

See the Pen Untitled by kabuto64425 (@kabuto64425) on CodePen.

以上です。

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