vue2写法
<!-- 此处的 slot-scope="scope"就是作用域插槽 -->
<template slot-scope="scope">
<!-- 内部获取作用域插槽scope.row row为当前行的值 -->
<el-button type="danger" @click="delete(scope.row.id)">删除</el-button>
</template>
<script>
// 方法拿值
delete(id){
console.log(id)
.....
}
</script>
vue3写法
<!-- 作用域插槽,此处的 #default="scope"为作用域插槽 -->
<template #default="scope">
<!-- 内部获取作用域插槽的值 scope.row row为当前行的值 -->
<el-switch v-model="scope.row.mg_state" @click="delete(scope.row.id,scope.row.mg_state)"/>
</template>
<script>
// 方法拿值
delete(id,state){
console.log(id,state)
.....
}
</script>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。