element table可以显示多行文字吗?超过了才显示省略号,鼠标悬浮的时候显示出来完整的。

鼠标悬浮后的效果

参考代码
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="description" label="描述">
<template #default="scope">
<el-tooltip class="item" effect="dark" :content="scope.row.description" placement="top">
<div class="ellipsis-text">{{ scope.row.description }}</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</template>
<style scoped>
.ellipsis-text {
display: -webkit-box;
-webkit-line-clamp: 2; /* 最多显示2行 */
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
white-space: normal; /* 允许换行 */
}
</style>