Effect
description of renderings:
Only the title with more than 10 words will display the el-tooltip, and the ones without
exceeding 10 words will not be displayed Idea: The data in the table exceeds 10 words, display and hide, use the hover effect to display the el-tooltip and display all the text
Code:
<el-table-column label="标题" width="180">
<template slot-scope="scope">
<el-tooltip
class="item"
effect="dark"
:content="scope.row.title"
placement="bottom"
popper-class="tips"
>
<span v-if="scope.row.title.length >= 10">{
{
scope.row.title
}}</span>
</el-tooltip>
<span v-if="scope.row.title.length < 10">{
{
scope.row.title
}}</span>
</template>
</el-table-column>
/deep/.el-table td {
border-bottom: 1px solid #2E2C3D;
background: #242133;
.cell span {
display: block;
width: 10em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
**Tips:** It can also be achieved by changing the em unit in the cell style to width, depending on the requirements.