解決方案:通過(guò)控制el-popover的visible來(lái)讓其隱藏
1.在組件中引入自定義指令 import Clickoutside from 'element-ui/src/utils/clickoutside' // 從element-ui的依賴中引入
import Clickoutside from 'element-ui/src/utils/clickoutside'
2.自定義指令
directives: { Clickoutside },
3.通過(guò)控制visible來(lái)顯示
<el-popover
placement="bottom"
v-model="visible"
v-clickoutside="()=>visible=false"
@hide='hide'
trigger="click" popper-class="js_close"></el-popover>