From 991a7fd5bf73bb041116391f68cbcaf885d0fb82 Mon Sep 17 00:00:00 2001 From: Robert Zeng <163709439+upthen@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:21:01 +0800 Subject: [PATCH] fix(vant-compat): [Toast][Dialog] fix missed and incorrect export error #12952 (#12953) Co-authored-by: yongbo.zeng_U+ --- packages/vant-compat/src/dialog.ts | 2 +- packages/vant-compat/src/toast.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vant-compat/src/dialog.ts b/packages/vant-compat/src/dialog.ts index d2d8c8516..acc78dbf5 100644 --- a/packages/vant-compat/src/dialog.ts +++ b/packages/vant-compat/src/dialog.ts @@ -13,7 +13,7 @@ export const Dialog = (...args: Parameters) => Dialog.Component = VanDialog; Dialog.alert = Dialog; -Dialog.config = showConfirmDialog; +Dialog.confirm = showConfirmDialog; Dialog.close = closeDialog; Dialog.setDefaultOptions = setDialogDefaultOptions; Dialog.resetDefaultOptions = resetDialogDefaultOptions; diff --git a/packages/vant-compat/src/toast.ts b/packages/vant-compat/src/toast.ts index e22373a70..2dc7302b8 100644 --- a/packages/vant-compat/src/toast.ts +++ b/packages/vant-compat/src/toast.ts @@ -3,6 +3,7 @@ import { closeToast, showFailToast, showSuccessToast, + showLoadingToast, allowMultipleToast, setToastDefaultOptions, resetToastDefaultOptions, @@ -33,6 +34,14 @@ Toast.success = (...args: Parameters) => { }; }; +Toast.loading = (...args: Parameters) => { + const toast = showLoadingToast(...args); + return { + clear: toast.close, + ...toast, + } +} + Toast.clear = closeToast; Toast.allowMultiple = allowMultipleToast; Toast.setDefaultOptions = setToastDefaultOptions;