vuejs v-else code example
Example 1: v-if vuejs
<h1 v-if="awesome">Vue is awesome !</h1>
<h1 v-else-if="sowSow">Vue is not very nice !</h1>
<h1 v-else>Vue is baaaad !</h1>
Example 2: vue v-if
<div v-if="Math.random() > 0.5">
Now you see me
</div>
<div v-else>
Now you don't
</div>
Example 3: elseif vuejs
<div v-if="type === 'A'">
A
</div>
<div v-else-if="type === 'B'">
B
</div>
<div v-else-if="type === 'C'">
C
</div>
<div v-else>
Not A/B/C
</div>
Example 4: vue v-if compare string
<span v-for="role in user.roles">
<span v-if="role.name == 'Admin'">Yes</span>
<span v-else>-</span>
</span>
Example 5: vue if
<h1 v-if="variable">Vue is awesome!</h1>