feat: 使用 showToast 和 showSuccessToast 替换 toastController,简化提示逻辑

This commit is contained in:
2026-01-22 19:18:42 +07:00
parent cfa7b0e820
commit 5cb485f4d2
2 changed files with 6 additions and 19 deletions

2
auto-imports.d.ts vendored
View File

@@ -109,6 +109,7 @@ declare global {
const shallowReactive: typeof import('vue').shallowReactive const shallowReactive: typeof import('vue').shallowReactive
const shallowReadonly: typeof import('vue').shallowReadonly const shallowReadonly: typeof import('vue').shallowReadonly
const shallowRef: typeof import('vue').shallowRef const shallowRef: typeof import('vue').shallowRef
const showSuccessToast: typeof import('vant/es').showSuccessToast
const showToast: typeof import('vant/es').showToast const showToast: typeof import('vant/es').showToast
const storeToRefs: typeof import('pinia').storeToRefs const storeToRefs: typeof import('pinia').storeToRefs
const syncRef: typeof import('@vueuse/core').syncRef const syncRef: typeof import('@vueuse/core').syncRef
@@ -450,6 +451,7 @@ declare module 'vue' {
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']> readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']> readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']> readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
readonly showSuccessToast: UnwrapRef<typeof import('vant/es')['showSuccessToast']>
readonly showToast: UnwrapRef<typeof import('vant/es')['showToast']> readonly showToast: UnwrapRef<typeof import('vant/es')['showToast']>
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']> readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
readonly syncRef: UnwrapRef<typeof import('@vueuse/core')['syncRef']> readonly syncRef: UnwrapRef<typeof import('@vueuse/core')['syncRef']>

View File

@@ -43,20 +43,12 @@ async function confirmSubscribe() {
} }
if (!paymentPassword.value) { if (!paymentPassword.value) {
toastController.create({ showToast("请输入交易密码");
message: "请输入交易密码",
duration: 2000,
position: "top",
}).then(toast => toast.present());
return; return;
} }
if (!currentWallet.value || Number(currentWallet.value?.available) < Number(product.value.price)) { if (!currentWallet.value || Number(currentWallet.value?.available) < Number(product.value.price)) {
toastController.create({ showToast("所选钱包余额不足,请选择其他钱包或充值");
message: "所选钱包余额不足,请选择其他钱包或充值",
duration: 2000,
position: "top",
}).then(toast => toast.present());
return; return;
} }
@@ -65,17 +57,10 @@ async function confirmSubscribe() {
walletTypeId: selectedWallet.value, walletTypeId: selectedWallet.value,
tradePassword: paymentPassword.value, tradePassword: paymentPassword.value,
})); }));
const toast = await toastController.create({ showSuccessToast("产品申购成功!");
message: "产品申购成功!",
duration: 2000,
position: "bottom",
color: "success",
});
await toast.present();
setTimeout(() => { setTimeout(() => {
toast.dismiss();
emit("success"); emit("success");
}, 2000); }, 1000);
} }
</script> </script>