1. html
<el-table :data="tableList" style="width: 100%" :header-cell-style="cellStyle">
<el-table-column :label="item.label" v-for="(item, i) in headerList" :key="i">
<template slot-scope="scope">
<div v-if="item.prop=='remark'">
<div v-if="scope.row.isUpGateway">{{ scope.row[item.prop] }}</div>
<div v-else style="color: #E74E4E">{{ scope.row[item.prop] }}</div>
</div>
<div v-else>{{ scope.row[item.prop] }}</div>
</template>
</el-table-column>
<el-table-column v-if="operate" fixed="right" label="操作" width="100">
<template slot-scope="scope">
<div class="btns" v-if="scope.row.isUpGateway" @click="showPop(scope.row)">{{ btn }}</div>
</template>
</el-table-column>
</el-table>
2.js
headerList: [
{
prop: "ip",
label: "网关IP"
},
{
prop: "port",
label: "网关端口"
},
{
prop: "connectTime",
label: "连接时间"
},
{
prop: "gatewayCode",
label: "网关编码"
},
{
prop: "heartTime",
label: "最新心跳"
},
{
prop: "remark",
label: "说明"
// isInput: true
}
],
tableList: [],
tableData: [
{
remark: 111,
isUpGateway:true,
connectTime: 3
},
{
remark: 111,
isUpGateway:false,
connectTime: 3
},
{
remark: 111,
isUpGateway:true
}
]