使用filte过滤掉table某一行数据
<el-table v-loading="loadingDetail" :data="hostListDetailAll" @selection-change="handleSelectionChange">
<el-table-column label="主机类型" align="center" prop="hostType" :formatter="hostTypeFormat" />
</el-table>
js代码
data(){
return{
// 主机管理表格数据
hostListDetail: [],
}
}
//方法
computed: {
// 不显示测试型主机
hostListDetailAll: function () {
var arr = this.hostListDetail.filter((data) => {
return data.hostType !== 2;
});
console.log(arr);
return arr;
},
},
/** 查询主机管理列表 */
getListDetail() {
this.loadingDetail = true;
marchHostDeviceInfo({
testCaseIdList: this.form.testCaseIdList,
loopFrequency: this.form.loopFrequency,
startTime: this.form.startTime,
endTime: this.form.endTime,
planType: this.form.planType,
executeTime: this.form.executeTime,
}).then((response) => {
this.hostListDetail = response.rows;
this.totalDetail = response.rows.length;
this.loadingDetail = false;
});
},