|
@@ -27,7 +27,9 @@ const props = withDefaults(
|
|
>(),
|
|
>(),
|
|
{ showClose: true },
|
|
{ showClose: true },
|
|
);
|
|
);
|
|
-const emits = defineEmits<{ close: [] } & DialogContentEmits>();
|
|
|
|
|
|
+const emits = defineEmits<
|
|
|
|
+ { close: []; closed: []; opened: [] } & DialogContentEmits
|
|
|
|
+>();
|
|
|
|
|
|
const delegatedProps = computed(() => {
|
|
const delegatedProps = computed(() => {
|
|
const {
|
|
const {
|
|
@@ -44,7 +46,13 @@ 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() {
|
|
|
|
+ if (props.open) {
|
|
|
|
+ emits('opened');
|
|
|
|
+ } else {
|
|
|
|
+ emits('closed');
|
|
|
|
+ }
|
|
|
|
+}
|
|
defineExpose({
|
|
defineExpose({
|
|
getContentRef: () => contentRef.value,
|
|
getContentRef: () => contentRef.value,
|
|
});
|
|
});
|
|
@@ -57,6 +65,7 @@ defineExpose({
|
|
</Transition>
|
|
</Transition>
|
|
<DialogContent
|
|
<DialogContent
|
|
ref="contentRef"
|
|
ref="contentRef"
|
|
|
|
+ @animationend="onAnimationEnd"
|
|
v-bind="forwarded"
|
|
v-bind="forwarded"
|
|
:class="
|
|
:class="
|
|
cn(
|
|
cn(
|