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 3 years have passed since last update.

ほぼ備忘録のように書いていいます。

v-for

<ul>
	<li v-for=“item in items” :key=“item.message”>{{ item.message }}</li>
</ul>

itemsの中身を順番にitemの変数に格納する。

v-for=”変数 in オブジェクト”

v-if

<div v-if="type === 'A'">
  A
</div>
<div v-else>
  Not A/B/C
</div>


“type === ‘A’”を評価し、
正の場合v-ifのブロックの内容を表示
負の場合v-elseのブロックを表示

v-if=“変数・式”

v-on

<div id="app">
  <button v-on:click="onClick">ボタン</button>
</div>

イベントをトリガーにしてメソッドや指揮を実行する

v-on:イベント名="メソッド名または式"

v-model

<input v-model="message”>
<p>Message is: {{ message }}</p>

input要素に入った内容を定義した変数に入れ表示させる

v-model=“変数”

v-bind

<template>
  <input v-bind="{ type:'text', maxlength: 3 }">
</template>

<input type="text" maxlength="3">

要素に対してプロパティを適用します。









参考

https://qiita.com/ota-meshi/items/ffa875daa9ebc9fc57c0
https://johobase.com/vue-js-v-on-directive/
https://jp.vuejs.org/v2/guide/list.html
https://jp.vuejs.org/v2/guide/conditional.html
https://jp.vuejs.org/v2/guide/forms.html

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?