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

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b357ae-2bf8e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b357ae-2bf8e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?