0
0

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] v-modelを使用したフォームの基本を簡潔に

Posted at

フォーム系のタグは、v-modelディレクティブを利用してリアルタイムに管理ができる。

input type=“checkbox”は複数の場合は配列に格納する。入るのはvalueの値。

index.vue
<div id="app">
<input type="checkbox" name="" id="" v-model="Category" value="value-1" />
<input type="checkbox" name="" id="" v-model="Category" value="value-2" />
<input type="checkbox" name="" id="" v-model="Category" value="value-3" />
<p>{{Category}}</p>
</div>
<script src="app.js"></script>
app.js
Vue.createApp({
  data: function () {
    return {
      message: 'メッセージ',
      Category: [],
    };
  },
}).mount('#app');

表示
スクリーンショット 2022-06-20 12.01.38.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?