Browse Source

fix: dialog `opened/closed` event triggered incorrectly,fixed #4902 (#4908)

pull/4916/head
Netfan 1 year ago
committed by GitHub
parent
commit
1302092798
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      packages/@core/ui-kit/shadcn-ui/src/ui/dialog/DialogContent.vue

13
packages/@core/ui-kit/shadcn-ui/src/ui/dialog/DialogContent.vue

@ -48,11 +48,14 @@ const delegatedProps = computed(() => {
const forwarded = useForwardPropsEmits(delegatedProps, emits);
const contentRef = ref<InstanceType<typeof DialogContent> | null>(null);
function onAnimationEnd() {
if (props.open) {
emits('opened');
} else {
emits('closed');
function onAnimationEnd(event: AnimationEvent) {
// contentRef opened/closed
if (event.target === contentRef.value?.$el) {
if (props.open) {
emits('opened');
} else {
emits('closed');
}
}
}
defineExpose({

Loading…
Cancel
Save