From 057e4bfe3a20cd1ec9ce487c41f78910cd42398e Mon Sep 17 00:00:00 2001 From: deepfal Date: Mon, 18 Aug 2025 15:15:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(index):=20=E6=B7=BB=E5=8A=A0=E5=90=8E?= =?UTF-8?q?=E9=80=80=E6=8C=89=E9=94=AE=E8=87=AA=E5=AE=9A=E4=B9=89=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在首页组件中添加 onBackPress 方法 - 当详情页显示时,后退键关闭详情页并返回列表 - 否则,执行系统默认后退行为(退出应用) --- src/pages/index/index.ux | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pages/index/index.ux b/src/pages/index/index.ux index 48d3940..6f3402d 100644 --- a/src/pages/index/index.ux +++ b/src/pages/index/index.ux @@ -716,6 +716,17 @@ export default { vibrator.vibrate({ mode: 'short' }) + }, + + onBackPress() { + console.log('触发:onBackPress') + // 如果详情页打开,则关闭详情页返回列表 + if (this.showDetailPage) { + this.hideDetail() + return true // 自己处理,不执行系统默认返回 + } + // 否则执行系统默认返回行为(退出应用) + return false } }