方法一
<el-table-column label="领取状态" prop="state" :render-header="renderHeader">
<template slot-scope="scope">
{{scope.row.state == 4 ? '入账失败' : state[scope.row.state]}}
</template>
</el-table-column>
renderHeader (h, {column) {
const array = [
h('div', {slot: 'content',style: 'font-size:14px;line-height:25px;', '积分、商城优惠券:'),
h('div', {slot: 'content',style: 'font-size:14px;line-height:25px;', '未入账:未调用接口'),
h('div', {slot: 'content',style: 'font-size:14px;line-height:25px;', '入账中:线程批次跑批执行入账,正在调用接口未完成'),
h('div', {slot: 'content',style: 'font-size:14px;line-height:25px;', '入账失败:接口响应失败'),
h('div', {slot: 'content',style: 'font-size:14px;line-height:25px;', '入账成功:接口响应成功'),
]
return h(
'div', [
h('span', column.label),
h('el-tooltip', {
props: {
effect: 'dack',
placement: 'top'
}
}, [
array,
h('i', {
class:'el-icon-question',
style: 'color: #409eff;margin-left:5px;'
})
]
]
)
}
方法二
<el-table-column prop="state" >
<tempalte slot-scope="scope" slot="header">
领取状态
<el-tooltip effect="dark" palcement="top">
<div slot="content" class="t-conent" v-html="content"></div>
<i class="el-icon-question iconStyle"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
{{scope.row.state == 4 ? '入账失败' : state[scope.row.state]}}
</template>
</el-table-column>
export default {
data () {
retrun {
content: `<div class="t-title">积分、商城优惠券:</div>
<div>未入账:未调用接口</div>
<div>入账中:线程批次跑批执行入账,正在调用接口未完成</div>
<div>入账失败:接口响应失败</div>
<div>入账成功:接口响应成功</div>
`
}
}
}
//样式修改 v-html样式穿透
<style lang="less" scoped>
.iconStyle{
color: #409eff;margin-left:5px;
}
.t-conent{
/deep/ div{font-size:14px;line-height:25px;}
/deep/ .t-title{padding-top:20px;font-weight:500;}
}
</style>