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

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐