Netfan
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
5 deletions
-
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({ |
|
|
|
|