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)
})
Tech Blog
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)
})