openUpdateForm (user) {
this.userUpdate = user
this.showUpdateDialog = true
},
复制代码
在vuejs的项目里,通过上面的函数,将user的值复制给userUpdate
(user和userUpdate是Object)
但是当我修改userUpdate的值的同时,user的值也跟着改变。
如果只想改变userUpdate的值,
openUpdateForm (user) {
this.userUpdate = JSON.parse(JSON.stringify(user))
this.showUpdateDialog = true
},
复制代码
这样就不会连带着user一起改变了。~~