The influence of Vue on the same value

api.getxx({},(res)=>{

  this.data1 = res

  this.data2 = res

})

 

   this.data1.splice(1,1) The value of data2 will also change.

  Solution: cloning

api.getxx({},(res)=>{

  this.data1 = res

  this.data2 = res.slice(0)

})

 

Leave a Reply

Your email address will not be published. Required fields are marked *