LoginSignup
1
0

More than 1 year has passed since last update.

Vue.js v-ifの使い方

Last updated at Posted at 2022-03-13

概要

Vue.jsでv-ifによる処理の方法を記載します。

記述方法

v-ifは以下のようにv-if, v-elseという形式で記載します。
タグは処理の内容によって変更してください。

<template v-if="条件">
   // 条件にあった場合の処理を書く
</template>

実例

<template v-if="A">
   // Aの場合の処理
</template>
<template v-else-if="B">
   // Bの場合の処理
</template>
<template v-else>
   // A,B以外の場合の処理
</template>

基本的には他のプログラム言語のif文と同じような感覚で使用できます。

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