可以通过自定义列来实现
设置 :selectable="isSelectable"
html
<template>
<el-table :data="tableData" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" :selectable="isSelectable">
</el-table-column>
<el-table-column prop="name" label="Name" width="180">
</el-table-column>
<el-table-column prop="ip" label="IP" width="180">
</el-table-column>
<el-table-column prop="hostname" label="Hostname">
</el-table-column>
</el-table>
</template>
script
javascript
isSelectable(row, index) {
// 根据 row.state 判断是否可选
return row.state == 1
}
🆗🦌