el-table 列内容溢出隐藏,鼠标悬浮提示效果

场景:在备注内容很多的情况下,将列表都展示出来,会显得行特别的高;所以需要进行溢出隐藏处理,并在鼠标悬浮的时候进行特殊的提示;

效果

 

 

 参考 Element UI 官方文档:可尝试在 el-table-column 上加上show-overflow-tooltip属性;

show-overflow-tooltip当内容过长被隐藏时显示 tooltipBooleanfalse

 本例关键代码

<el-table id="out-table" :header-cell-style="{ background: '#eef1f6', color: '#606266','text-align':'center' }" :data="detailList"
 stripe style="width: 100%;" border>
	<el-table-column align="center" prop="item" label="名称"> </el-table-column>
	<el-table-column align="right" prop="price" label="单价"> </el-table-column>
	<el-table-column align="right" prop="num" label="件数"> </el-table-column>
	<el-table-column align="right" prop="handle_price" label="价格"></el-table-column>
	<el-table-column align="right" prop="discount_price" label="共计"></el-table-column>
	<el-table-column align="center" prop="remark" label="备注">
		<template v-slot="scope">
			<el-tooltip class="item" effect="light" placement="top">
				<div v-html="scope.row.remark" slot="content" style="max-width:300px"></div>
				<div class="oneLine">{{scope.row.remark}}</div>
			</el-tooltip>
		</template>
	</el-table-column>

</el-table>
<style>
.oneLine {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值