Elementui:el-table结合filters实现表头的筛选过滤功能
<el-table-column
prop="location"
label="安装位置"
align="center"
min-width="160"
:filters="LocationList"
:filter-multiple="false"
:filter-method="typeFilter"
filter过滤对象数组
filter-placement="bottom-start"
column-key="locationJointName"
>
filters 的数组元素内部为有 text 和 value 的对象
filter-method 过滤⽅法没有起到实际作⽤
需要结合 filter-change ⼀起使⽤,当表格的筛选条件发⽣变化的时候会触发该事件
<el-table
v-if="show"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
class="assetTable"
:key="tableKey"
@filter-change="filterChange"
@selection-change="handleSelectionChange"
>
filterChange(filters){
if(!filters)return;
if(filters["locationJointName"]){
this.locationId= filters["locationJointName"][0];
}
if(filters["brand"]){
this.manufacturerId = filters["brand"][0];
}
},
filters["locationJointName"]其中的 locationJointName 是由 column-key 做的标识

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。