ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.1k stars 14.64k forks source link

[Bug Report] The Select Component cannot hide the Popover Component(Select组件无法收起Popover组件) #21667

Open microkof opened 2 years ago

microkof commented 2 years ago

Element UI version

2.15.7

OS/Browsers version

Windows 10 64 / Chrome 86

Vue version

2.6.14

Reproduction Link

https://codepen.io/microkof/pen/dyZyaqd

Steps to reproduce

  1. Copy the Select component and Popover component from the official website's examples.

  2. Click to open the Popover component.

  3. Click to open the Select component and you will find that Popover is not stowed.

What is Expected?

Click to open the Select component and Popover will stow.

What is actually happening?

Click to open the Select component and you will find that Popover is not stowed.

Kryst4ljy commented 2 years ago

可以在 el-select 组件上添加 focus 事件,当触发 el-select 组件的 focus 事件后获取 el-popover 组件 调用其内部的 doClose 事件手动关闭。

<el-select
      @focus="selectFocus"
    >
   .../
    <el-popover
      ref="popover"
    >

.../

// methods
methods: {
    selectFocus() {
      this.$refs.popover.doClose();
    },
  },`
biaobaba commented 2 years ago

这个方法在跨组件的时候 好像并不能用