el-table 实现单选

<el-table
    :data="tableData"
    @selection-change="handleSelectionChange">
    <el-table-column
        type="selection"
        fixed>
    </el-table-column>
</el-table>
methods: {
    handleSelectionChange(selection) {
      if (selection.length > 1) {
        this.$refs.elTable.clearSelection(); // 清空所有选择
        this.$refs.elTable.toggleRowSelection(selection.pop()); // 设置选择项
      }
    },
}

你可能感兴趣的:(vue.js,javascript,前端)