elementui el-table超出两行显示…鼠标已入tip显示
方式一
<el-table-column
label="描述"
prop="note"
class-name="myNoteBox"
>
<template slot-scope="scope">
<el-tooltip placement="top">
<div slot="content" class="table-tip-box" >
{{ scope.row.text}}
div>
<div class="table-ellipsis">{{ scope.row.text}}div>
el-tooltip>
template>
el-table-column>
.table-ellipsis {
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
}
// 提示框的最大宽度
.table-tip-box {
max-width: 500px;
}
方式二
<el-table-column
v-if="false"
label="描述"
prop="note"
class-name="myNoteBox"
>
<template slot-scope="scope">
<el-popover
placement="top-start"
width="200"
trigger="hover"
:content="scope.row.text"
>
<div slot="reference" class="twoLineCls">
{{ scope.row.text}}
</div>
</el-popover>
</template>
</el-table-column>
.twoLineCls {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}