How to switch between Vue and class

<ul class="fs-8" id="select-product-app">
    <li class="chose-btns-contianer">25</li>
    <li class="chose-btns-contianer">26</li>
    <li class="chose-btns-contianer">27</li>
    <li class="chose-btns-contianer">28</li>
    <li class="chose-btns-contianer">29</li>
    <li class="chose-btns-contianer">30</li>
</ul>

as shown in the code, how to add a btn-active class for li after vue is clicked, and click something else to switch back and forth?

Mar.04,2021

vue is implemented with: class='' method. Vue needs to be bound to a unique judgment condition for each li.
for example: classShow is ture or false

<li v-for='(item,index) in lists' class="chose-btns-contianer"  :class='{"btn-active":item.classShow}' @click='run(index)'>25</li>

run(index){
     this.lists.forEach(v=>{
         v.classShow=false;//libtn-active
     })
    this.lists[index].classShow=true;
}

to make such class switching, vue is more troublesome than jq;


use a flag to mark which element is currently clicked, and when flag is consistent with the current element, add btn-active

<ul class="fs-8" id="select-product-app">
    <li class="chose-btns-contianer" @click="flag=25"
    :class="{'btn-active': flag===25}">25</li>
    <li class="chose-btns-contianer" @click="flag=26"
    :class="{'btn-active': flag===26}">26</li>
    <li class="chose-btns-contianer" @click="flag=27"
    :class="{'btn-active': flag===25}">27</li>
    <li class="chose-btns-contianer" @click="flag=28"
    :class="{'btn-active': flag===28}">28</li>
</ul>

1. Define the class name you want to add in data

2.

index

3.

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-1b30a57-2b4aa.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-1b30a57-2b4aa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?