方案1
<el-table :data="tableData" ref="table" row-key="id" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" :reserve-selection="true"></el-table-column>
...
</el-table>
handleSelectionChange (rows) {
this.selectedData = rows
}
> reserve-selection 在数据更新之后保留之前选中的数据
> this.$refs.table.clearSelection() 清空选中的数据
方案2(不推荐)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>vue</title>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<el-table ref="table" :data="tableData" style=