修复讲解详情页返回按钮
This commit is contained in:
@@ -400,14 +400,29 @@ const handleNavigate = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fallbackToExplainHome = () => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index?tab=explain'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleBack = () => {
|
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({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
fail: () => {
|
fail: fallbackToExplainHome
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/index/index?tab=explain'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user