el-popover组件内input框输入中文导致失去hover的解决方法

问题描述

我希望在使用element-plus的el-popover组件中放一个input框做搜索功能

在这里插入图片描述

这个组件在trigger:"click"的情况下没有问题,但是当,trigger:“hover” 时只要一输入中文就会导致组件隐藏,在github上找到该问题以及解决方案github连接
在这里插入图片描述
由于该问题仅在hover时触发,所以通过切换trigger的类型解决该问题

<el-popover v-model:visible="popVisible" placement="bottom-end" :width="300" :trigger="popTrigger">
  <div class="pro-search">
    <el-input
      v-model="iptValue"
      style="width: 100%"
      placeholder="搜索"
      prefix-icon="Search"
      @compositionstart="popTrigger = 'click'"
      @compositionend="popTrigger = 'hover'"
      clearable
    />
  </div>
  <div class="pro-list">
    <div class="pro-item">选项一</div>
    <div class="pro-item">选项二</div>
    <div class="pro-item">选项三</div>
    <div class="pro-item">选项四</div>
  </div>
  <template #reference>
    <span class="pro-name">
      选项一
    </span>
  </template>
</el-popover>
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值