vue數據變化但頁面沒有刷新,深度copy對象

方法1:使用this.$set

let list = {};      
for(let key  in this.listData){
  this.$set(list,key,this.listData[key])
}

方法2:使用this.$forceUpdate強制刷新

let list =this.listData;
this.$forceUpdate();  

方法3:JSON轉換

let list=JSON.parse(JSON.stringify(this.listData));  

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章