catch promise
This commit is contained in:
@@ -65,14 +65,18 @@ const mediaItems: Ref<Media[]> = ref([]);
|
||||
* Handle the user adding a new media item.
|
||||
*/
|
||||
const handleClickAdd = async () => {
|
||||
openDialog(SMDialogMedia, { mime: "", accepts: "" }).then((result) => {
|
||||
const media = result as Media;
|
||||
openDialog(SMDialogMedia, { mime: "", accepts: "" })
|
||||
.then((result) => {
|
||||
const media = result as Media;
|
||||
|
||||
mediaItems.value.push(media);
|
||||
value.value.push(media.id);
|
||||
mediaItems.value.push(media);
|
||||
value.value.push(media.id);
|
||||
|
||||
emits("update:modelValue", value);
|
||||
});
|
||||
emits("update:modelValue", value);
|
||||
})
|
||||
.catch(() => {
|
||||
/* empty */
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,25 +66,29 @@ const waitForElementRender = (elem: Ref): Promise<HTMLElement> => {
|
||||
* @returns {void}
|
||||
*/
|
||||
export const transitionEnter = (elem: Ref, transition: string): void => {
|
||||
waitForElementRender(elem).then((e: HTMLElement) => {
|
||||
window.setTimeout(() => {
|
||||
e.classList.replace(
|
||||
transition + "-enter-from",
|
||||
transition + "-enter-active"
|
||||
);
|
||||
const transitionName = transitionEndEventName();
|
||||
e.addEventListener(
|
||||
transitionName,
|
||||
() => {
|
||||
e.classList.replace(
|
||||
transition + "-enter-active",
|
||||
transition + "-enter-to"
|
||||
);
|
||||
},
|
||||
false
|
||||
);
|
||||
}, 1);
|
||||
});
|
||||
waitForElementRender(elem)
|
||||
.then((e: HTMLElement) => {
|
||||
window.setTimeout(() => {
|
||||
e.classList.replace(
|
||||
transition + "-enter-from",
|
||||
transition + "-enter-active"
|
||||
);
|
||||
const transitionName = transitionEndEventName();
|
||||
e.addEventListener(
|
||||
transitionName,
|
||||
() => {
|
||||
e.classList.replace(
|
||||
transition + "-enter-active",
|
||||
transition + "-enter-to"
|
||||
);
|
||||
},
|
||||
false
|
||||
);
|
||||
}, 1);
|
||||
})
|
||||
.catch(() => {
|
||||
/* empty */
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user