美文网首页
ant design vue的tooltip的宽度修改不生效

ant design vue的tooltip的宽度修改不生效

作者: 尘埃里的玄 | 来源:发表于2022-05-18 17:56 被阅读0次

今天在tooltip中加入table然后尝试修改宽度一直不生效,真的焦灼万分,在标签上用自带的属性不行,直接加style不行,加类写样式不行,样式穿透给底层组件样式也不生效。最后才发现加的位置不对。


image.png

在调试页面修改.ant-tooltip的属性一直不生效,最后也是百度一了文章找到了原因所在。
其需要修改的宽度是.ant-tooltip-inner的宽度
上代码:

        <a-tooltip color="white" @mouseenter="hoverMethod(record)" overlayClassName="bgc_tooltip">
          <template #title>
            <a-table :columns="sendColumns" :data-source="data" bordered>
              <template #name="{ text }">
                <a>{{ text }}</a>
              </template>
            </a-table>
          </template>
          {{ record.send }}
          <!--          <a-button @hover="test(record)">{{ record.send }}</a-button>-->
        </a-tooltip>
<style lang="less">
  // 注意,vue 项目,style 标签不能加 scoped 选项,否则样式不生效
  .bgc_tooltip {
    .ant-tooltip-inner {
      // 这里是框框
      color: #333;
      max-width: 800px !important;[图片上传中...(image.png-1ef6a4-1652867772021-0)]
ant;
    }
    .ant-tooltip-arrow::before {
      // 这里是小三角形
      background-color: white !important;
    }
  }
</style>
image.png
使用官方的属性也不生效
参考文档: https://blog.csdn.net/dark_cy/article/details/116986569

相关文章

网友评论

      本文标题:ant design vue的tooltip的宽度修改不生效

      本文链接:https://www.haomeiwen.com/subject/bevaurtx.html