欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

el-table 筛选、复选框保持多选框选中状态

程序员文章站 2022-07-13 23:02:32
...

el-table 筛选、复选框保持多选框选中状态

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;
},