From dbc6002248092ce1a8f141a6b190f09c71f870b0 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Sat, 25 Jul 2026 08:50:43 +0800 Subject: [PATCH] fix(vr page): optimize navigation bar title setting logic add optional chaining to safely access res.data.title, only set navigation bar title when title exists, fallback to default removed --- pages_tool/vr/index.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages_tool/vr/index.vue b/pages_tool/vr/index.vue index 42ae7be..35d1adb 100644 --- a/pages_tool/vr/index.vue +++ b/pages_tool/vr/index.vue @@ -12,15 +12,15 @@ export default { }; }, onLoad(option) { - // 确保导航栏标题显示 - this.$api.sendRequest({ url: '/api/config/defaultvr', success: res => { if (res.code == 0) { - uni.setNavigationBarTitle({ - title: res.data.title || '工厂展示' - }); + if (res.data?.title) { + uni.setNavigationBarTitle({ + title: res.data.title + }); + } this.src = res.data.url } },