element ui table 多选 选中当前行 直接勾选

140 阅读1分钟

element ui table 多选 选中当前行 直接勾选

<el-table
    ref="multipleTable"
    :data="tableWaferData"
    @selection-change="handleCurrentRowSublist"
    :height="pxToRem(200)"
 
    @row-click="handleCurrentChange"
    border
    style="width: 100%"
>
    <el-table-column type="selection" width="40"  />
    <el-table-column prop="waferId" label="Wafer Id" min-width="85" show-overflow-tooltip />
</el-table>
<script setup>
// 点击行选中复选框
const handleCurrentChange = (row) => {
    currentRow.value = row
    multipleTable.value.toggleRowSelection(row)
}

</script>

ps: 代码纯属记录工作中遇到的问题或者组件,因为每次面试都会问哈哈哈