使用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
中自定义类名