mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 04:27:26 +08:00
feat(components): [popconfirm] expose hide function and popperRef (#21681)
* feat(components): [popconfirm] expose hide function and popperRef * Update docs/en-US/component/popconfirm.md Co-authored-by: btea <2356281422@qq.com> * Update docs/en-US/component/popconfirm.md Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> * chore: bump tweak --------- Co-authored-by: yinshenghao <shenghao.yin@eslink.com> Co-authored-by: btea <2356281422@qq.com> Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> Co-authored-by: Dsaquel <291874700n@gmail.com>
This commit is contained in:
@ -52,7 +52,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, unref } from 'vue'
|
||||
import ElButton from '@element-plus/components/button'
|
||||
import ElIcon from '@element-plus/components/icon'
|
||||
import ElTooltip from '@element-plus/components/tooltip'
|
||||
@ -72,6 +72,9 @@ const emit = defineEmits(popconfirmEmits)
|
||||
const { t } = useLocale()
|
||||
const ns = useNamespace('popconfirm')
|
||||
const tooltipRef = ref<TooltipInstance>()
|
||||
const popperRef = computed(() => {
|
||||
return unref(tooltipRef)?.popperRef
|
||||
})
|
||||
|
||||
const hidePopper = () => {
|
||||
tooltipRef.value?.onClose?.()
|
||||
@ -98,4 +101,9 @@ const finalConfirmButtonText = computed(
|
||||
const finalCancelButtonText = computed(
|
||||
() => props.cancelButtonText || t('el.popconfirm.cancelButtonText')
|
||||
)
|
||||
|
||||
defineExpose({
|
||||
popperRef,
|
||||
hide: hidePopper,
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user