跳转逻辑

parent 62c70bb4
......@@ -351,7 +351,7 @@ const recommendedListOfPeripherals = ref([]);
onLoad(async (options) => {
params.value.shopId = options.shopId;
shopId.value = options.shopId;
scrollToTop();
// 使用 Promise.all 并行请求,提升性能
await Promise.all([
getStoreInformationFn(options.shopId),
......@@ -368,7 +368,13 @@ onLoad(async (options) => {
// 获取位置并计算距离
calculateDistance();
});
function scrollToTop() {
// 使用 scrollTo 方法滚动到顶部
xma.pageScrollTo({
scrollTop: 0,
duration: 300, // 动画时间,可选
});
}
onShow(async () => {
await getStoreInformationFn(params.value.shopId);
......@@ -376,24 +382,28 @@ onShow(async () => {
calculateDistance();
});
async function refreshShowDetail(item) {
params.value.shopId = item.shopId;
shopId.value = item.shopId;
// params.value.shopId = item.shopId;
// shopId.value = item.shopId;
// 使用 Promise.all 并行请求,提升性能
await Promise.all([
getStoreInformationFn(item.shopId),
groupBuyListFn(item.shopId),
couponShopListFn(item.shopId),
]);
// // 使用 Promise.all 并行请求,提升性能
// await Promise.all([
// getStoreInformationFn(item.shopId),
// groupBuyListFn(item.shopId),
// couponShopListFn(item.shopId),
// ]);
// 获取周边推荐信息
peripheryRecomFn();
// // 获取周边推荐信息
// peripheryRecomFn();
// 获取评价信息
getEvaluationPageFn();
// // 获取评价信息
// getEvaluationPageFn();
// 获取位置并计算距离
calculateDistance();
// // 获取位置并计算距离
// calculateDistance();
/// /////////////////////
xma.navigateTo({
url: `/pages/shop/shop?shopId=${item.shopId}`,
});
}
// 计算距离的函数封装
async function calculateDistance() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment