When reading "Reactivity in Depth" in the documentation, I see two points which I am not sure how to interpret:
When you pass a plain JavaScript object to a Vue instance as its data option, Vue will walk through all of its properties and convert them to getter/setters using
Object.defineProperty
(...)
Due to the limitations of modern JavaScript (and the abandonment of
Object.observe
), Vue cannot detect property addition or deletion. Since Vue performs the getter/setter conversion process during instance initialization, a property must be present in the data object in order for Vue to convert it and make it reactive.
How does this related to nested object such as
[
{
"a": 1,
"b": [
{
"c": 1
},
...
]
},
{
"a": 10,
"b": [
{
"c": 10
},
...
]
},
...
]
Specifically, how should such object be presented to data()
so that it is reactive?
data() {
return {
likeThis: [],
orLikeThat: [{}],
orMoreDetailed: [{a: null, b:[]}],
orTheFullStucture: [{a: null, b:[{c: null}]}]
}
}