diff --git a/src/pages/exhibit/detail.vue b/src/pages/exhibit/detail.vue index 202396b..9918660 100644 --- a/src/pages/exhibit/detail.vue +++ b/src/pages/exhibit/detail.vue @@ -400,14 +400,29 @@ const handleNavigate = async () => { }) } +const fallbackToExplainHome = () => { + uni.reLaunch({ + url: '/pages/index/index?tab=explain' + }) +} + const handleBack = () => { + if (typeof window !== 'undefined' && window.history.length > 1) { + const currentHref = window.location.href + window.history.back() + + // H5 深链或异常历史栈下 history.back 可能不改变页面,兜底回到讲解首页。 + window.setTimeout(() => { + if (window.location.href === currentHref) { + fallbackToExplainHome() + } + }, 800) + return + } + uni.navigateBack({ delta: 1, - fail: () => { - uni.reLaunch({ - url: '/pages/index/index?tab=explain' - }) - } + fail: fallbackToExplainHome }) }