刷新似乎不适用于我的 BootstrapVue <b-table> 组件
Refresh doesn't seems to work for my BootstrapVue <b-table> component
尽管我正在使用刷新方法,但在我更改其 items[] 记录的某些元素后,我的 没有得到更新:
我必须添加一条 dummy/ghost 记录,然后将其删除以获取我要更新的记录:
this.items[this.posItemEdited] = element;
//this.$refs['theTable'].refresh(); //Doesn't work
//this.$root.$emit('bv::refresh::table', 'theTable'); //Doesn't work
//TRICK: add and delete
this.items.push(element);
this.items.splice(this.items.length - 1, 1);
由于 Vue.js
反应性中的警告,以下代码不起作用
this.items[this.posItemEdited] = element;
要解决这个问题你需要使用$set
:
this.$set(this.items, this.posItemEdited, element)
尽管我正在使用刷新方法,但在我更改其 items[] 记录的某些元素后,我的 没有得到更新:
我必须添加一条 dummy/ghost 记录,然后将其删除以获取我要更新的记录:
this.items[this.posItemEdited] = element;
//this.$refs['theTable'].refresh(); //Doesn't work
//this.$root.$emit('bv::refresh::table', 'theTable'); //Doesn't work
//TRICK: add and delete
this.items.push(element);
this.items.splice(this.items.length - 1, 1);
由于 Vue.js
反应性中的警告,以下代码不起作用this.items[this.posItemEdited] = element;
要解决这个问题你需要使用$set
:
this.$set(this.items, this.posItemEdited, element)