cellStyle使用方法;rowStyle同理,只是接收的参数不同,具体参数看element官网
methods: {
cellStyle({row, column, rowIndex, columnIndex}) {
let styleJson = {
height: '32px',
width: '100%',
padding: '0px !important',
}
if (row.id == '5d75f0ab0f3e197fd15a5c12' && columnIndex == 2) {
styleJson.backgroundColor = 'red'
} else {
styleJson.backgroundColor = '#fff'
}
return styleJson // 返回对象
},
},
el-table(:data="tableData" border height="228px" :cell-style="cellStyle")
el-table-column(type="index" label="序号" align="center" width="50px")
el-table-column(prop="label" label="字段名称" align="center")
el-table-column(prop="is_require" label="内容是否为必填" align="center")
template(slot-scope="scope")
el-checkbox(checked disabled)
el-table-column(label="快速录入启用" align="center")
template(slot-scope="scope")
el-checkbox(disabled)
el-table-column(label="快速录入设置" align="center" )
template(slot-scope="scope")
el-button(type="text" style="color:#d9d9d9;" disabled) 设置
el-table-column(prop="is_show" label="页面是否显示" align="center")
template(slot-scope="scope")
el-checkbox(checked disabled)
el-table-column(label="是否为日期" align="center")
template(slot-scope="scope")
el-checkbox(disabled)
el-table-column(prop="placeholder" label="字段填写说明" align="center")