Element Plus el-tooltip嵌套el-popover

1.场景

需求在按钮中鼠标移入显示Tooltip文字提示,点击显示Popover提示框

2.实现

el-tooltip与el-popover之间需要有一层dom元素

<template>
  <el-tooltip effect="dark" :show-after="500" content="功能开发" placement="right">
    <span ref="dom">  // 重要
      <el-popover placement="right" class="!bg-[var(--box-bg-color)]" :width="200" trigger="click">
        <div class="flex flex-wrap gap-1">
          <div
            class="flex flex-col w-50px h-50px justify-center items-center b-rd-3px cursor-pointer hover:bg-#d5dcff"
            :class="fun.show ? 'bg-#d5dcff' : ''"
            v-for="fun in funConfig"
            :key="fun.name"
            @click="fun.show = !fun.show"
          >
            <svg-icon :icon-class="fun.icon" class="text-30px"></svg-icon>
            <span class="text-12px">{{ fun.name }}</span>
          </div>
        </div>
        <template #reference>
          <button type="button" class="mapboxgl-ctrl-icon mapboxgl-style-fun"></button>
        </template>
      </el-popover> 
    </span>
  </el-tooltip>
</template>

posted @   槑孒  阅读(280)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
点击右上角即可分享
微信分享提示