diff --git a/packages/devui-vue/devui/popover/src/popover-icons.tsx b/packages/devui-vue/devui/popover/src/popover-icons.tsx index db9b74f09e..a76f672002 100644 --- a/packages/devui-vue/devui/popover/src/popover-icons.tsx +++ b/packages/devui-vue/devui/popover/src/popover-icons.tsx @@ -1,3 +1,5 @@ +// SVG paths are too long to be displayed in the code. +/* eslint-disable max-len */ export function SuccessIcon(): JSX.Element { return ( diff --git a/packages/devui-vue/devui/popover/src/use-popover.ts b/packages/devui-vue/devui/popover/src/use-popover.ts index a090f8ca08..469a2a88c4 100644 --- a/packages/devui-vue/devui/popover/src/use-popover.ts +++ b/packages/devui-vue/devui/popover/src/use-popover.ts @@ -14,7 +14,7 @@ export function usePopover( props: PopoverProps, visible: Ref, placement: Ref, - origin: Ref, + origin: Ref, popoverRef: Ref ): { overlayStyles: ComputedRef> } { const { trigger, isOpen } = toRefs(props); @@ -24,7 +24,10 @@ export function usePopover( })); const onDocumentClick: (e: Event) => void = (e: Event) => { - if (!origin.value.contains(e.target) && !popoverRef.value.$el?.contains(e.target)) { + if ( + !origin.value?.contains(e.target) && + !popoverRef.value.$el?.contains(e.target) + ) { visible.value = false; } }; diff --git a/packages/devui-vue/docs/en-US/components/popover/index.md b/packages/devui-vue/docs/en-US/components/popover/index.md index a5d93ef7a7..a76d0110be 100644 --- a/packages/devui-vue/docs/en-US/components/popover/index.md +++ b/packages/devui-vue/docs/en-US/components/popover/index.md @@ -1,31 +1,30 @@ -# Popover +# Popover Simple text prompt box. ### When To Use Used to notify users of non-critical problems or to indicate that a control is in a special situation. ### Basic Usage -When Popover pops up, it is positioned based on the contents of the reference slot. :::demo ```vue
- + - + - + - + @@ -50,7 +49,7 @@ When Popover pops up, it is positioned based on the contents of the reference sl ``` ::: -### Custom Tips +### Custom Tips The HTMLElement or TemplateRef type can be transferred. :::demo @@ -88,7 +87,7 @@ A total of 12 pop-up positions are supported. ```vue - + - + - + @@ -133,7 +132,7 @@ A total of 12 pop-up positions are supported. top-left - + @@ -144,7 +143,7 @@ A total of 12 pop-up positions are supported.
- + @@ -152,7 +151,7 @@ A total of 12 pop-up positions are supported. right - + - + - + @@ -189,7 +188,7 @@ A total of 12 pop-up positions are supported. bottom-left - + @@ -214,7 +213,7 @@ Displaying the pop-up dialog box through the visible interface to verify the for :::demo ```vue