组件的数组索引的数据我需要更新我的VueJS组件阵列的一些数据,通过v-for
渲染为一个列表中的模板。没有更新
当我更新整个数组时,我发现列表在DOM中更新。但是,如果我仅更新索引,则列表不会更新。
这里有两个相关的方法:
methods: {
loadOnlyOneIndex: function() {
this.data[0] = {
title: 'Hello error',
slug: 'hello',
desc: 'will not work'
};
},
loadEverything: function() {
this.data = [{
title: 'Hello new title',
slug: 'hello',
desc: 'this will work'
}, {
title: 'Hello new title 2 !',
slug: 'hello2',
desc: 'really work'
}];
}
}
https://vuejs.org/v2/guide/list.html#Caveats – thanksd
谢谢,这是真正棘手看到对象更新,但不认为... – moabi