- 知识点:主要用到table的@filter-change="filterChange"属性方法,结合定义的total(数据共多少条)
<el-table
ref="table"
@filter-change="filterChange"
>
<el-table-column label='是否管控' prop="inspe" align="center"
:filters="[{ text: '是', value: true }, { text: '否', value: false }]"
:filter-method="filterHandlerClass">
<template slot-scope="scope" >
{{scope.row[scope.column.property]?'是':'否'}}
</template>
</el-table-column>
</ el-table>
filterHandlerClass(value, row, column) {
const property = column['property'];
return row[property] === value;
},
filterChange() {
this.total = this.$refs.table.tableData.length;
console.log(this.total);
}