87,901
社区成员
发帖
与我相关
我的任务
分享
<input type='checkbox' v-model='item.isChecked' @change='switchBillSelected(item)'></input>
switchBillSelected(item) {
if (!item.isChecked) {
for (let i=0; i<this.bills.length; i++) {
if (this.bills[i].id == item.id) {
this.bills.splice(i, 1)
break;
}
}
}
}
<input type='checkbox' v-model='item.isChecked' @change='switchBillSelected(item)'></input>
switchBillSelected(item) {
if (!item.isChecked) {
for (let i=0; i<this.bills.length; i++) {
if (this.bills[i].id == item.id) {
this.bills.splice(i, 1)
break;
}
}
// Keep an alias of this.bills
let alias = this.bills;
// Re-bind this.bills to refresh the check status of visible rows
this.bills = [];
setTimeout((bills) => {
this.bills= bills;
}, 500, alias)
}
}