In v-for, how do you add class, to 5 out of 21 li and then you can't add it again?

now you need to do a collection function that can select 5 out of 21 li.

<ul>
  <li v-for="(item,index) in mylotteryList" :key="index" :class="setClass(index)" @click="check_show(index)">
     {{item.title}}
  </li>
</ul>

mylotteryList loop has 21 li

  methods:{
    setClass(index){

    },
    check_show(index) {

    },
  }
Jul.30,2021

this requirement logic is very simple. Click li to add the non-repeating item push to the array. If the length reaches 5, it cannot be added. As for class, as long as it judges that the item of the current circular column is in the cache array, it can display the specified class
to write you a small example

.
Menu