el-popover(vue3 总结)

一  使用

 <el-popover placement="right" :width="400" trigger="click">
      <template #reference>
        <el-button style="margin-right: 16px">Click to activate</el-button>
      </template>
      <el-table :data="gridData">
        <el-table-column width="150" property="date" label="date" />
        <el-table-column width="100" property="name" label="name" />
        <el-table-column width="300" property="address" label="address" />
      </el-table>
    </el-popover>

二 调整上下距离

第一步:定义一个类 

第二步: 设置样式, 在公共样式中设置才起效果

   <el-popover :width="280" trigger="click" popper-class="equity_info" placement="right">
          <template #reference> <div class="rights">权益信息</div> </template>
          <div class="network_content">
            <div class="title">全网线索补全</div>
            <div class="network_content_detail">
              <div class="detail_title"
                >已消耗/总量
                <el-tooltip
                  class="box-item"
                  effect="dark"
                  placement="right"
                  :enterable="false"
                  :hide-after="0"
                >
                  <template #content>
                    已消耗积分:<br />
                    实际消耗积分和当前冻结积分之和<br />
                    (当前冻结积分将根据实际消耗情况进行扣减)
                  </template>
                  <el-icon style="position: relative; top: 2px" size="14px"><Warning /></el-icon>
                </el-tooltip>
              </div>
              <div class="detail_content"> <span style="color: #477fff">1000</span>/5000</div>
            </div>
            <div class="network_content_detail">
              <div class="detail_title">有效期止 </div>
              <div class="detail_content">2024-12-31</div>
            </div>
          </div>
        </el-popover>
.equity_info {
  top: 10px !important;
  .el-popper__arrow {
    top: 15px !important;
  }
}

 三 el-popover嵌套el-tooltip

移入到el-tooltip,后边的el-popover消失了

解决: 不让他移入,只在标签上能看提示,移入消失

  :enterable="false"//鼠标是否可进入到 tooltip 中

但是会抽搐一下

解决:

     :hide-after="0"//延迟关闭,单位毫秒

  • 5
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue3中,el-popover并不是Vue的官方组件,而是Element UI库中的一个组件。Element UI是一个基于Vue.js的组件库,提供了丰富的UI组件,用于快速开发Web应用程序。 要使用el-popover组件,首先需要安装Element UI。可以通过npm或yarn安装Element UI,然后在项目的入口文件中引入Element UI的样式和组件。 安装Element UI: ``` npm install element-plus ``` 引入Element UI: ```javascript import { createApp } from 'vue' import ElementPlus from 'element-plus' import 'element-plus/lib/theme-chalk/index.css' const app = createApp(App) app.use(ElementPlus) app.mount('#app') ``` 接下来,在需要使用el-popover的组件中,可以直接使用el-popover组件。 示例代码: ```html <template> <div> <el-popover trigger="hover" placement="top"> <p>这是一个Popover</p> <button slot="reference">点击我</button> </el-popover> </div> </template> ``` 上述示例中,el-popover组件被包裹在一个div中。通过设置trigger属性为"hover",当鼠标悬停在按钮上时,Popover会显示。placement属性指定Popover的位置,这里设置为"top",表示在按钮上方显示。 需要注意的是,以上代码只是一个简单的示例,实际使用时,可能还需要根据需要配置其他属性和事件来满足具体的需求。 总结:在Vue3中使用el-popover组件,需要先安装Element UI并引入相关样式和组件,然后在需要使用的组件中直接使用el-popover标签,并根据需要配置相关属性和事件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值