3👍
✅
You can clone the prop value, with these methods:
- If the value is a simple data type (string, boolean, number):
this.mensagem = JSON.parse(JSON.stringify(this.mensagemEdit));
- If the value is a simple object:
this.mensagem = Object.assign({}, this.mensagemEdit);
- For more complex values (array of objects, nested objects) I suggest using lodash:
import { cloneDeep } from "lodash"
this.mensagem = cloneDeep(this.mensagemEdit);
Source:stackexchange.com