From 07064b4b85e6bdcd3e1d5342edee0ffff42fbdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com> Date: Wed, 10 Sep 2025 10:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=AB=E7=A0=81=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=AE=8C=E6=88=90=E8=BF=94=E5=9B=9E=E9=94=AE=EF=BC=8C?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9C=AA=E5=88=B7=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/common/qrcode/qrcode.vue | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pages/common/qrcode/qrcode.vue b/pages/common/qrcode/qrcode.vue index fd8689a..d3137e3 100644 --- a/pages/common/qrcode/qrcode.vue +++ b/pages/common/qrcode/qrcode.vue @@ -86,14 +86,29 @@ } catch (error) {} } }, - }, - onLoad(options) { - if (options.deviceId) { - this.deviceId = decodeURIComponent(options.deviceId); - } else { - this.deviceId = '未获取到设备ID'; - } + }, + // 处理返回键 + onBackPress() { + // 如果绑定成功了,返回时也要刷新首页 + if (this.isSuccess) { + uni.$emit('refreshDeviceList'); } + return false; // 允许正常返回 + }, + // 页面卸载时处理 + onUnload() { + // 如果绑定成功了,卸载时也要刷新首页 + if (this.isSuccess) { + uni.$emit('refreshDeviceList'); + } + }, + onLoad(options) { + if (options.deviceId) { + this.deviceId = decodeURIComponent(options.deviceId); + } else { + this.deviceId = '未获取到设备ID'; + } + } }