data: function () {
return {
cityData: cityData,
selectedOptions:this.source[this.schema_key]
}
}
This.source[this.schema_key] on the console is as follows
[24, 81, __ob__: Observer]
Is there a way to directly obtain such data
[24, 81]
__ob__: Observer
These data are monitors set by the vue framework for data, and are generally non-enumerable.console.log
这样的打印函数,被打印的变量会执行自身的toString()
In this way, even if the internal properties are not enumerable, they can actually be seen. For example:Because you have bound the data in vue, vue must add monitors for the data. If you forcefully delete these monitors, then the data will lose monitoring, so what is the point of using vue? Where is...
If you just remove these monitors without considering the consequences, just copy the object, because the copied object does not contain non-enumerable attributes.
In dynamic languages like js, copying objects is a headache. I wrote a simple one, you can refer to it:
Just use the
clone()
method directly outside.This has no impact on the data~
Similarly, solve it. . . .