mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
22 lines
544 B
TypeScript
22 lines
544 B
TypeScript
import type { DirectiveBinding, ObjectDirective } from 'vue'
|
|
import type { PopoverInstance } from './popover'
|
|
|
|
const attachEvents = (el: HTMLElement, binding: DirectiveBinding) => {
|
|
const popperComponent: PopoverInstance = binding.arg || binding.value
|
|
const popover = popperComponent?.popperRef
|
|
if (popover) {
|
|
popover.triggerRef = el
|
|
}
|
|
}
|
|
|
|
export default {
|
|
mounted(el, binding) {
|
|
attachEvents(el, binding)
|
|
},
|
|
updated(el, binding) {
|
|
attachEvents(el, binding)
|
|
},
|
|
} as ObjectDirective
|
|
|
|
export const VPopover = 'popover'
|