解决扫码后,可以进行返回首页
This commit is contained in:
parent
992459f4f2
commit
89cf6ec570
|
|
@ -2,7 +2,11 @@
|
|||
<view class="page">
|
||||
<base-background />
|
||||
<!-- 使用自定义导航栏组件 -->
|
||||
<custom-navbar ref="customNavbar" title="往生大殿" />
|
||||
<custom-navbar
|
||||
ref="customNavbar"
|
||||
title="往生大殿"
|
||||
@back="handleNavbarBack"
|
||||
/>
|
||||
<view class="header">
|
||||
<!-- 搜索框 -->
|
||||
<search-box
|
||||
|
|
@ -148,6 +152,7 @@ import OfferingModal from "./compositons/offeringModal.vue";
|
|||
import { getIdBySN, getPackageList } from "../../api/memorial/memorial";
|
||||
import { ordersEnshrined } from "../../api/order/order";
|
||||
import { checkLogin } from "../../composables/goToLogin";
|
||||
import { navigateBack } from "../../utils/router.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
@ -456,7 +461,10 @@ export default {
|
|||
) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -499,6 +507,13 @@ export default {
|
|||
console.log("滚动位置:", e.detail.scrollTop);
|
||||
this.scrollTop = e.detail.scrollTop;
|
||||
},
|
||||
|
||||
// 处理导航栏返回事件
|
||||
handleNavbarBack() {
|
||||
console.log("@@@@@如果没有上一页会自动跳转到首页");
|
||||
// 使用路由工具函数,如果没有上一页会自动跳转到首页
|
||||
navigateBack();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ export function navigateBack(delta = 1) {
|
|||
delta,
|
||||
fail: () => {
|
||||
// 如果没有上一页,跳转到首页
|
||||
switchToTab("index");
|
||||
// 使用 reLaunch 而不是 switchTab,因为首页不是 tabBar 页面
|
||||
reLaunchToPage("index");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user