When you edit a form, the data in the form changes

why

There is a reference relationship here: this.roleForm and row refer to the same object, change one, and the other is affected

this.roleForm = row
Copy the code

Shallow copy (assign address to address)

Copy: is to assign the same value to the two elements.

Let Xiao Wang have the same electric bike as you

Xiao Kao bei: matched a key to your electric car to Xiao Wang

Deep copy: send the same electric car to Xiao Wang

The solution

Change the shallow copy to the deep copy