LoginSignup
0
0

More than 1 year has passed since last update.

v-else

Posted at

先ほどはtrueの時の表示だけですが、
falseの場合の表示もさせてみます。

ここで使うのが

v-else

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.js"></script>
<div id="app">
<p v-if="ok">OK</p>
<p v-else>NG</p>
</div>
new Vue({
  el: '#app',
   data: {
   ok: false
 }
})

20210506-201222.png

v-elseはv-ifの直後に使うこと。

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