The data that has been looped out by vue has been changed by clicking on the event, but the page data has not been updated.

 <div class="condition" :style="{background: item.collectColor}" v-for="(item,index) in myCollectList" :key="item.id"
             @click="selectMyCollectList(item,index)">
          <span>{{item.collectTitleName}}</span><i class="el-icon-check"  v-show="item.selected"></i>
        </div>
        
        
        selectMyCollectList(item,index) {
        item.selected = !item.selected;
        }
        
       
       
   
Feb.28,2021

set it to responsive data first

for (let i = 0; i < _this.myCollectList.length; iPP) {
              _this.$set(_this.myCollectList[i], 'selected', false)
            }
        

the data can be changed at this time, and the view will change

 selectMyCollectList(item,index) {
    item.selected = !item.selected;
    }
    

this.$set 

this.$set(item, 'selected', !item.selected)

:key="index"

key is the

of the index in the array bound to your loop.
  selectMyCollectList(item,index) {
        item.selected = !item.selected;
        }

there is no problem with this method, you can try to print to the page to see the data changes, there should be a problem elsewhere.

 <span>{{item.selected}}</span><i class="el-icon-check"  v-show="item.selected"></i>

Click to change the data, and you have to change the data in data. This method is changed as follows:

selectMyCollectList(item,index) {
    this.myCollectList[index]['selected']=!this.myCollectList[index]['selected'];
}

is the subject of the old version of vue? I also encountered this problem in my recent interview, but my page data is updated in real time, and I don't know why I ran through my project with the subject's code.

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