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