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:
@@ -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
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user