A
A
alexeeey_kuznetsov2019-08-14 17:54:23
Vue.js
alexeeey_kuznetsov, 2019-08-14 17:54:23

How to set class name depending on index in v-for?

It is necessary for me to add in a cycle for each subsequent (with an increase in the cycle) title an animation delay. I planned to add the delay itself through the index of the cycle. But in dynamic addition of classes `${index}` does not work like this.
https://codepen.io/alexeeey_kuznetsov/pen/xxKVKvG
In the codepen example, I just for example cited that this class is added with advantage.notThreeLines. I just need to add such a class to each h3 but with a different value (classes delay-1s, delay-2s, delay-3s).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-08-14
@alexeeey_kuznetsov

:class="{ [`delay-${index}s`]: advantage.notThreeLines }"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question