0👍
you can try :
<div class="element" v-for="error in errors" :key="error" :class="step==1 ? 'class1' :
step==2 ? 'class2':'class3'">
....
</div>
- [Vuejs]-Floating Label In Vue/Tailwind
- [Vuejs]-Nuxt js with Docker: module not found: Error: Can't resolve
0👍
I would suggest an approach like this:
<div v-for="error in errors" :key="error" :class="`class_${step}`" >
<span @click="modify()"> {{error}}</span>
</div>
Or if you don’t want to name your classes that way:
<div v-for="error in errors" :key="error" :class="getClass" >
<span @click="modify()"> {{error}}</span>
</div>
...
methods: {
getClass() {
if (this.step === 1) return 'classA';
if (this.step === 2) return 'classB';
// etc.
}
}
- [Vuejs]-How to scroll a div left programmatically in vue?
- [Vuejs]-Swiper.js bugged: It knows that there are multiples slides but it doesn't let you navigate through them
Source:stackexchange.com