解决扫码后,可以进行返回首页

This commit is contained in:
WindowBird 2025-10-16 16:02:02 +08:00
parent 992459f4f2
commit 89cf6ec570
2 changed files with 19 additions and 3 deletions

View File

@ -2,7 +2,11 @@
<view class="page"> <view class="page">
<base-background /> <base-background />
<!-- 使用自定义导航栏组件 --> <!-- 使用自定义导航栏组件 -->
<custom-navbar ref="customNavbar" title="往生大殿" /> <custom-navbar
ref="customNavbar"
title="往生大殿"
@back="handleNavbarBack"
/>
<view class="header"> <view class="header">
<!-- 搜索框 --> <!-- 搜索框 -->
<search-box <search-box
@ -148,6 +152,7 @@ import OfferingModal from "./compositons/offeringModal.vue";
import { getIdBySN, getPackageList } from "../../api/memorial/memorial"; import { getIdBySN, getPackageList } from "../../api/memorial/memorial";
import { ordersEnshrined } from "../../api/order/order"; import { ordersEnshrined } from "../../api/order/order";
import { checkLogin } from "../../composables/goToLogin"; import { checkLogin } from "../../composables/goToLogin";
import { navigateBack } from "../../utils/router.js";
export default { export default {
components: { components: {
@ -456,7 +461,10 @@ export default {
) { ) {
await this.$refs.statusBar.loadUnitData(this.selectedUnitId); await this.$refs.statusBar.loadUnitData(this.selectedUnitId);
} }
if (this.$refs.enshrinedList && typeof this.$refs.enshrinedList.refresh === "function") { if (
this.$refs.enshrinedList &&
typeof this.$refs.enshrinedList.refresh === "function"
) {
await this.$refs.enshrinedList.refresh(); await this.$refs.enshrinedList.refresh();
} }
} }
@ -499,6 +507,13 @@ export default {
console.log("滚动位置:", e.detail.scrollTop); console.log("滚动位置:", e.detail.scrollTop);
this.scrollTop = e.detail.scrollTop; this.scrollTop = e.detail.scrollTop;
}, },
//
handleNavbarBack() {
console.log("@@@@@如果没有上一页会自动跳转到首页");
// 使
navigateBack();
},
}, },
}; };
</script> </script>

View File

@ -136,7 +136,8 @@ export function navigateBack(delta = 1) {
delta, delta,
fail: () => { fail: () => {
// 如果没有上一页,跳转到首页 // 如果没有上一页,跳转到首页
switchToTab("index"); // 使用 reLaunch 而不是 switchTab因为首页不是 tabBar 页面
reLaunchToPage("index");
}, },
}); });
} }