3 ms·
Since first toying with Ember early on, I've decided that a good test of many of these MVVM libraries is to see how we can easily share data across multiple vie
by pedalpete 13y ago
Since first toying with Ember early on, I've decided that a good test of many of these MVVM libraries is to see how we can easily share data across multiple views.
I'm not entirely sure how that would work Vue.js. I suppose at some point you could have
var parent = new Vue(options);
parent.$data = [object,object,object];
var child = new Vue(options);
child.$data = parent.$data[i];
seems simple enough, what's your scratch test before trying a new library?
- malkomalko 13y agoalso look at http://vuejs.org/guide/composition.html http://vuejs.org/guide/composition.html
- EvanYou 13y ago$data has to be an object, but yes you can share data between multiple ViewModels simply by assigning them. Note however this won't create nested scope between the two. To allow the child to get full access to the parent's data you need to compose them with v-component.