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
This commit is contained in:
2026-07-25 08:50:43 +08:00
parent ed8a316bc0
commit dbc6002248

View File

@@ -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
}
},