vue中使用Object.assign导致视图不响应

可以正常响应的

<template>
    <div>
       <ul>
           <li class="li-item" v-for="(item,index) in list" :key="index" @click="hander(item)">
               {{item}}
           </li>
       </ul>
    </div>
</template>
<script>
   export default {
        data(){
            return{
                list:[]
            }
        },created(){
            setTimeout(()=>{
                let  arr=[
                    { name:'张三1',flag:true},{ name:'张三2',{ name:'张三3',{ name:'张三4',]
                let newList=[];
                for(let i=0;i<arr.length;i++){
                    let item=arr[i];
                    console.log(item)
                    let a=Object.assign(item,{'select':true});
                    newList.push(a)
                }   
                this.list=newList;
            },300)
        },methods:{
            hander(mess){
               for(let i=0;i<this.list.length;i++){
                    if(mess.name==this.list[i].name){
                       this.list[i].select=! mess.select;
                    }
               }
            },},}
</script>
<style scoped>
.li-item{
    height: 40px;
    background: #c0c0cc;
    line-height: 40px;
    margin-bottom: 10px;
}
</style>

不会正常的响应

今天太晚了,明天我在写一写;休息一会

相关文章

这篇文章我们将通过debug源码的方式来带你搞清楚defineAsync...
欧阳老老实实的更新自己的高质量vue源码文章,还被某2.6k st...
前言 在Vue3.5版本中响应式 Props 解构终于正式转正了,这个...
组合式 (Composition) API 的一大特点是“非常灵活”,但也因...
相信你最近应该看到了不少介绍Vue Vine的文章,这篇文章我们...
前言 在欧阳的上一篇 这应该是全网最详细的Vue3.5版本解读文...