需求:表格中有多个switch组件,回调的时候需要知道是那个switch发生了改变,并且改变的值为多少?,$event可以获取到当前改变的值
<el-table :data="tableData" stripe style="width: 100%"> <el-table-column prop="master_name" label="主审核人" width="180"></el-table-column> <el-table-column prop="slave_name" label="备审核人" width="180"></el-table-column> <el-table-column prop="applytype_name" label="工单类型"></el-table-column> <el-table-column label="状态"> <template slot-scope="scope"> <el-switch v-model="scope.row.status" active-color="#36c6d3" active-text="启用" inactive-text="关闭" active-value="1" inactive-value="0" @change="active_text($event, scope.row)" > </el-switch> </template> </el-table-column> </el-table>
active_text (value, row) {
console.log(value, row)
}