效果图
<el-descriptions-item label="巡检事项">
<el-tooltip :disabled="tooltipShow" placement="top">
<div slot="content" style="width: 350px">
{{ currentInfo.inspectionInfo.inspectionItem }}
</div>
<span
@mouseenter="mouseEnter"
@mouseleave="mouseLeave"
style="
overflow: hidden;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
"
>{{ currentInfo.inspectionInfo.inspectionItem }}</span>
</el-tooltip>
</el-descriptions-item>
mouseEnter(event) {
const offsetWidthData = event.target?.offsetWidth;
const scrollWidthData = event.target?.scrollWidth;
if (scrollWidthData > offsetWidthData) {
this.tooltipShow = false;
}
},
mouseLeave() {
this.tooltipShow = true;
},
``