[Vuejs]-How can I add a element everytime after 4 elements in Vue.js?

0👍

You can access v-for iteration number like this:

change

 .column.is-3.vid(v-for='item in items')

to

.column.is-3.vid(v-for='(item, index) in items')

then somewhere where you need it check the index:

v-if="(index % 4 === 0) ? 'show it after every 4 elements' : ''"

for example, inject a span:

<span v-if="index % 4 === 0">after 4</span>

Leave a comment