& lt; Input type='checkbox' v - model='item. IsChecked' @ change='switchBillSelected (item)' & gt;
SwitchBillSelected (item) {
if (! Item. IsChecked) {
For (the let I=0; iIf (this. Bills [I] id==item. Id) {
This. Bills. Splice (I, 1)
break;
}
}
}
}
In order to solve this problem, I changed the code above, to bind data, under forced to refresh the form:
& lt; Input type='checkbox' v - model='item. IsChecked' @ change='switchBillSelected (item)' & gt;
SwitchBillSelected (item) {
if (! Item. IsChecked) {
For (the let I=0; iIf (this. Bills [I] id==item. Id) {
This. Bills. Splice (I, 1)
break;
}
}
//Keep an alias of enclosing bills
Let alias=this. Bills;
//Re - bind this. Bills to refresh the check the status of the visible rows
This. Bills=[];
SetTimeout ((bills)=& gt; {
This. Bills=bills;
}, 500, alias)
}
}
This is really useful, but forced to refresh the entire form to less elegant, part one is the form will be flashing once, the second, it is actually around the question, is there a better way?
CodePudding user response:
Iview form?