Hi,
I discovered VueJS a few days ago and I am trying to use it for a web-app.
In the data object of a view, I have the following:
aView = new Vue({
el: '#filter',
data: {
testObject: {test:'test'},
test: 4
},
computed: {
testObjectLength: function () {
return Object.keys(this.testObject).length;
},
testAdd: function () {
return this.test+1;
}
}
});
The problem is that the computed attribute testObjectLength is not updated when new elements are added to the object (filterView.testObject[new] = 'new'; in javascript console) whereas the testAdd attribute works perfectly.
What am I doing wrong? Is there another way to get the number of properties of a javascript object?
Thanks a lot
V
http://vuejs.org/guide/reactivity.html#Change-Detection-Caveats
Didn't see that one, sorry.
Thanks a lot
Most helpful comment
http://vuejs.org/guide/reactivity.html#Change-Detection-Caveats