Closed wuxianliang closed 10 years ago
Indeed, this problem is related to three-way binding. For example,
v-model: ...
<----> vue instance
<----> Meteor Collection
Are you suggesting that if we change the v-model, the new value should be inserted or updated to the vue instance and Meteor collections? From practical and security standpoint, we encourage users to use vue's methods
or Meteor call()
to update or insert data to the databases, and the logic of running this belongs to the userland. Otherwise, meteor-vue
needs to define which collection to sync with the v-model, and it seems too cumbersome and opinionated for a package.
A naive example from my understanding:
var vm = new Vue({
data: {
completed: false
},
methods: {
onClick: function (e) {
Meteor.call('actionComplete', someTodos);
}
}
});
And then you can bind the v-on= "click: onClick"
on the input tag.
Thank you very much. I misunderstood the word "sync".
Dear Zhou: I am using meteor-vue with meteor 0.9.4 to reproduce todomvc and meet a problem: after coding sync: { todotoday: function () { startofDay = moment().startOf('day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'); endofDay = moment().startOf('day').add(1, 'days').format('YYYY-MM-DDTHH:mm:ss.SSSZ'); return todos.find({start: {$gt: startofDay, $lt: endofDay}}); } }, the v-model:"completed" does change on the client side, but server side. It looks like "read only". Could you please have a try? Thank you very much.