The v-else-if directive in Vue
Instead of several v-if, you can use v-else-if constructions:
<template>
<p v-if="num == 1">one</p>
<p v-else-if="num == 2">two</p>
<p v-else-if="num == 3">three</p>
<p v-else>error</p>
</template>
Let data store the following:
data() {
age: 25,
}
If the property age is less than 18 - display 'teenager', if it is from 19 to 25 - display 'young man boy sprig', and if more than 26 - display 'male'.