el-table 筛选、复选框保持多选框选中状态
程序员文章站
2022-07-13 23:02:32
...
view
<el-table tooltip-effect="dark" style="width: 100%" :row-key="getRowKeys" :data="tableData.filter(data => !search || data.nametj.toLowerCase().includes(search.toLowerCase()))" ref="multipleTable">
<el-table-column type="selection" width="55" prop="selection" :reserve-selection="true" ></el-table-column>
<el-table-column prop="nametj" label="筛选字段" width="220">
<template slot="header" slot-scope="scope">
<el-input v-model="search" size="mini" clearable placeholder="输入关键字搜索"/>
</template>
</el-table-column>
</el-table>
js
再次加载el-table 时清空复选框状态
this.$refs.multipleTable.selection.length=0; //清空复选框状态
getRowKeys(row){
return row.id;
},