修复扫码绑定完成返回键,首页未刷新问题

This commit is contained in:
微微一笑
2025-09-10 10:42:11 +08:00
parent 6ee45f6868
commit 07064b4b85

View File

@ -86,14 +86,29 @@
} catch (error) {} } catch (error) {}
} }
}, },
}, },
onLoad(options) { // 处理返回键
if (options.deviceId) { onBackPress() {
this.deviceId = decodeURIComponent(options.deviceId); // 如果绑定成功了,返回时也要刷新首页
} else { if (this.isSuccess) {
this.deviceId = '未获取到设备ID'; 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';
}
}
} }
</script> </script>