Files
element-plus/docs/examples/popover/virtual-triggering.vue
Zhong cd7bf873d0 docs(components): [popover] update examples (#21785)
* docs(components): [popover] remove `delayHide`

* docs: update

* docs: update

---------

Co-authored-by: warmthsea <2586244885@qq.com>
2025-08-18 09:38:35 +00:00

29 lines
600 B
Vue

<template>
<el-button ref="buttonRef" v-click-outside="onClickOutside">
Click me
</el-button>
<el-popover
ref="popoverRef"
:virtual-ref="buttonRef"
trigger="click"
title="With title"
virtual-triggering
>
<span> Some content </span>
</el-popover>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ClickOutside as vClickOutside } from 'element-plus'
import type { PopoverInstance } from 'element-plus'
const buttonRef = ref()
const popoverRef = ref<PopoverInstance>()
const onClickOutside = () => {
popoverRef.value?.hide()
}
</script>