el-tooltip
- 判断文本超出显示...时,显示tooltip
handleShowTooltip(event) {
let cell = event.target.querySelector('.el-tooltip')
this.showTooltip =
cell.scrollWidth === cell.offsetWidth &&
cell.scrollHeight === cell.offsetHeight
}
<div
@mouseenter="handleShowTooltip($event)"
class="listInfo"
v-for="(line,index)in item.lines" >
<el-tooltip :disabled="showTooltip" effect="dark" popper-class="toolTipClass":content="line.line" placement="top" >
<div style="white-space:pre" class="content" :class="{blue:line.isApplyLog==1}">{{line.line}}</div>
</el-tooltip>
</div>
- 自定义class
popper-class="toolTipClass"