在遍历中 使用 this.setData({}) 这个操作是否可行?如何优化成最好的方式呢?
data:{
list:[
{id:1,select:false},
{id:2,select:false},
{id:3,select:false},
{id:4,select:false},
]
},
methods:{
handle(){
this.data.list.forEach((v,i)=>{
this.setData({
[`list[${i}].select`]:true
})
})
}
}