el-switch 表格 异步后台设置
<el-switch
v-model="scope.row.status"
@change="changeStatus($event,scope.row,scope.$index)"
:active-value="1"
:inactive-value="2"
active-text="开"
inactive-text="关"
></el-switch>
function changeStatus(val, row, index) {
/先把值赋为原来的值,保证swich状态不变
row.status = val == 1 ? 2 : 1;
//再进行后端数据处理 返回~~~
//处理完后再根据具体情况更改 row.status
}