<el-table-column label="是否启用" >
<template slot-scope="scope">
<el-switch v-model="scope.row.enable"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ccc"
@change="changeEnable(scope.row)">
</el-switch>
</template>
</el-table-column>
函数
changeEnable(row){
this.request.post("/file/update",row).then(res => {
console.log("测试数据="+res.data);
if(res.code==='200'){
this.$message.success("操作成功!");
}
})
}