parent
ec53bf8084
commit
1302092798
|
@ -48,12 +48,15 @@ const delegatedProps = computed(() => {
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||||
|
|
||||||
const contentRef = ref<InstanceType<typeof DialogContent> | null>(null);
|
const contentRef = ref<InstanceType<typeof DialogContent> | null>(null);
|
||||||
function onAnimationEnd() {
|
function onAnimationEnd(event: AnimationEvent) {
|
||||||
|
// 只有在 contentRef 的动画结束时才触发 opened/closed 事件
|
||||||
|
if (event.target === contentRef.value?.$el) {
|
||||||
if (props.open) {
|
if (props.open) {
|
||||||
emits('opened');
|
emits('opened');
|
||||||
} else {
|
} else {
|
||||||
emits('closed');
|
emits('closed');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
getContentRef: () => contentRef.value,
|
getContentRef: () => contentRef.value,
|
||||||
|
|
Loading…
Reference in New Issue