el-tooltip 修改宽度

使用popper-classTooltippopper 添加类名

 <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中自定义类名
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44157964/article/details/126974233