使用popper-class为 Tooltip 的 popper 添加类名
<el-tooltip
effect="dark"
:content="row.range"
placement="top-start"
popper-class="tool-tip"
>
<div class="td-nowrap">{{ row.range }}</div>
</el-tooltip>
在当前组件新建一个style ,不要写scoped,这里的样式会应用到全局,所以class命名一定要保证不要和全局别的类名重复
<style lang="scss" scoped>
.td-nowrap {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<style>
.tool-tip {
max-width: 400px;
}
</style>
当然,也可以用slot,在slot中自定义类名

本文介绍如何使用Vue中的Element UI组件库的Tooltip组件,并通过popper-class属性来定制提示框的样式,包括最大宽度等属性。
1552

被折叠的 条评论
为什么被折叠?



