- 假设我要隐藏columns里的 “账户组名称”
columns: [
{
type: 'selection',
width: 60,
align: 'center'
},
{
title: '账号ID',
key: 'accountIdString'
},
{
title: '账号名称',
key: 'accountName'
},
{
title: '账户组名称',
key: 'accountGroupName'
}】
2.根据各自需求去判断
示例:如果是单账户表标题显示"账号ID、账号名称" 如果是账户组表标题显示"账户组名称"
if(this.queryCostComparisonData[i].accountGroupName){
this.columns = this.columns.filter(col => col.key !== 'accountIdString' );
this.columns = this.columns.filter(col => col.key !== 'accountName' );
}else{
this.columns = this.columns.filter(col => col.key !== 'accountGroupName' );
}