Skip to content

Trigger

Used to add hover, click, focus and other events to the element.

Basic usage

Basic usage of trigger.

Nested

Open a new pop-up box in the pop-up box.

Follow mouse

Setting the align-point attribute make the pop-up layer appear at the mouse position.

Click Here

Scroll container

Setting update-at-scroll attribute to listen to the containers scrolling.

Show arrow

Using show-arrow attribute, you can display the default arrow element.

With offset

Setting the popup-translate attribute to customize pop-up box is offset from basic position.

Trigger API

Trigger Attributes

NameDescriptionTypeDefault
v-modelWhether the popup is visibleBoolean-
default-popup-visibleWhether the popup is visible by default (uncontrolled mode)Booleanfalse
triggerTrigger methodStringhover
positionPopup positionStringbottom
disabledWhether the trigger is disabledBooleanfalse
popup-offsetWhether the trigger is disabledNumber0
popup-translateThe moving distance of the popupTriggerPopupTranslate-
show-arrowWhether the popup shows an arrowBooleanfalse
align-pointWhether the popup follows the mouseBooleanfalse
popup-hover-stayWhether to keep the popup displayed when the trigger is moved out and moved into the popupBooleantrue
blur-to-closeWhether to close the popup when the trigger loses focusBooleantrue
click-to-closeWhether to close the popup when the trigger is clickedBooleantrue
click-outside-to-closeWhether to close the popup when clicking on the outer areaBooleantrue
unmount-on-closeWhether to uninstall the popup node when closingBooleantrue
content-classThe class name of the popup contentString Array Object-
content-styleThe style of the popup contentCSSProperties-
arrow-classThe class name of the popup arrowString Array Object-
arrow-styleThe style of the popup arrowCSSProperties`-
popup-styleThe style of the popupCSSProperties`-
animation-nameThe name of the popup animationStringfade-in
durationThe duration of the popup animationNumber Object-
mouse-enter-delayDelay trigger time of mouseenter event (ms)Number100
mouse-leave-delayDelay trigger time of mouseleave event (ms)Number100
focus-delayDelay trigger time of focus event (ms)Number0
auto-fit-popup-widthWhether to set the width of the popup to the width of the triggerBooleanfalse
auto-fit-popup-min-widthWhether to set the minimum width of the popup to the trigger widthBooleanfalse
auto-fix-positionWhen the size of the trigger changes, whether to recalculate the position of the popupBooleantrue
popup-containerMount container for popupString HTMLElement-
update-at-scrollWhether to automatically adjust the position of the popup to update at scrollBooleantrue
auto-fit-positionWhether to automatically adjust the position of the popup to fit the window sizeBooleantrue
render-to-bodyWhether to mount under the body elementBooleantrue
prevent-focusWhether to prevent elements in the pop-up layer from gaining focus when clickedBooleanfalse

Trigger Events

NameDescriptionType
popup-visible-changeEmitted when the status of the popup changesFunction
showTriggered after the trigger is shown (the animation ends)-
hideTriggered after the popup is hidden (the animation ends)-

Trigger Slots

NameDescriptionType
contentContent-

FAQ

About the mount location of the pop-up box

The popup box is mounted on the body element by default. If you want to modify the mounted element, you can use the popup-container attribute to specify it. At the same time, you need to pay attention to ensure that the location of the mounted element can be accurately located. Generally, you can Add position: relative style for mount elements.

In the micro-frontend project, it is necessary to ensure that the mounting position of the sub-application is accurate, you can add position: relative to the body style of the sub-application