mounted: function() {
this.$watch('things', function(){console.log('a thing changed')}, true);
}
things
是一组对象 [{foo:1}, {foo:2}]
$watch
检测何时添加或删除对象,而不检测何时更改对象上的值。我怎样才能做到这一点?
vue.js $ watch对象数组
mounted: function() {
this.$watch('things', function(){console.log('a thing changed')}, true);
}
things
是一组对象 [{foo:1}, {foo:2}]
$watch
检测何时添加或删除对象,而不检测何时更改对象上的值。我怎样才能做到这一点?
第880篇《vue.js $ watch对象数组》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点
相似问题
问题类别
如果有人需要获取在数组内更改的项目,请检查它:
JSFiddle示例
帖子示例代码: