v-if directive code example
Example 1: 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 2: vue if
<h1 v-if="variable">Vue is awesome!</h1>
<span v-for="role in user.roles">
<span v-if="role.name == 'Admin'">Yes</span>
<span v-else>-</span>
</span>
<h1 v-if="variable">Vue is awesome!</h1>