feat: 修复toast异常问题
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<view class="booking h-screen flex flex-col">
|
<view class="booking h-screen flex flex-col">
|
||||||
<TopNavBar
|
<TopNavBar
|
||||||
titleAlign="center"
|
titleAlign="center"
|
||||||
:backgroundColor="$theme-color-100"
|
:backgroundColor="$theme - color - 100"
|
||||||
backIconColor="#000"
|
backIconColor="#000"
|
||||||
:shadow="false"
|
:shadow="false"
|
||||||
>
|
>
|
||||||
@@ -147,7 +147,7 @@ watch(
|
|||||||
if (newQuantity > currentLength) {
|
if (newQuantity > currentLength) {
|
||||||
// 数量增加,添加新的表单项
|
// 数量增加,添加新的表单项
|
||||||
const newForms = Array.from({ length: newQuantity - currentLength }, () =>
|
const newForms = Array.from({ length: newQuantity - currentLength }, () =>
|
||||||
createEmptyUserForm(),
|
createEmptyUserForm()
|
||||||
);
|
);
|
||||||
userFormList.value.push(...newForms);
|
userFormList.value.push(...newForms);
|
||||||
} else if (newQuantity < currentLength) {
|
} else if (newQuantity < currentLength) {
|
||||||
@@ -158,7 +158,7 @@ watch(
|
|||||||
// 等待DOM更新完成
|
// 等待DOM更新完成
|
||||||
await nextTick();
|
await nextTick();
|
||||||
},
|
},
|
||||||
{ immediate: false },
|
{ immediate: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
@@ -184,7 +184,7 @@ const getGoodsDetail = async (commodityId) => {
|
|||||||
// 取commodityFacilityList前3个
|
// 取commodityFacilityList前3个
|
||||||
orderData.value.commodityFacilityList = res.data.commodityFacilityList.slice(
|
orderData.value.commodityFacilityList = res.data.commodityFacilityList.slice(
|
||||||
0,
|
0,
|
||||||
3,
|
3
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,7 +211,6 @@ const validateUserForms = () => {
|
|||||||
|
|
||||||
// 处理支付点击事件
|
// 处理支付点击事件
|
||||||
const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
||||||
try {
|
|
||||||
console.log("处理支付点击事件", userFormList.value);
|
console.log("处理支付点击事件", userFormList.value);
|
||||||
// 校验用户姓名
|
// 校验用户姓名
|
||||||
if (!validateUserForms()) {
|
if (!validateUserForms()) {
|
||||||
@@ -314,16 +313,18 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
|||||||
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
// try {
|
||||||
console.error(error);
|
|
||||||
uni.hideLoading(); // 提前关闭 loading,确保 toast 能在安卓正常弹出
|
// } catch (error) {
|
||||||
setTimeout(() => {
|
// console.error(error);
|
||||||
uni.showToast({ title: "请求出错,请重试", icon: "none" });
|
// uni.hideLoading(); // 提前关闭 loading,确保 toast 能在安卓正常弹出
|
||||||
}, 100);
|
// setTimeout(() => {
|
||||||
} finally {
|
// uni.showToast({ title: "请求出错,请重试", icon: "none" });
|
||||||
// 最终兜底关闭 loading
|
// }, 100);
|
||||||
uni.hideLoading();
|
// } finally {
|
||||||
}
|
// // 最终兜底关闭 loading
|
||||||
|
// uni.hideLoading();
|
||||||
|
// }
|
||||||
}, 1000);
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user