In my component I have declared some data:
data() {
return {
defaultValue: {json object with some structure},
activeValue: {}
...
And within the component I assign defaultValue
to activeValue
:
this.activeValue = this.defaultValue
But the problem is, after I change this.activeValue
value the changes affect this.defaultValue
too.
If I use Object.freeze(this.defaultValue)
and then I try to change this.activeValue
I get an error - object is not writable.
How can I make a copy of the data but without reference ?
Map
– Pygmy