add optional chaining to safely access res.data.title, only set navigation bar title when title exists, fallback to default removed
46 lines
653 B
Vue
46 lines
653 B
Vue
<template>
|
|
<view :style="themeColor" class="vr-page">
|
|
<web-view :src="src" class="vr-webview"></web-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
src: ''
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
this.$api.sendRequest({
|
|
url: '/api/config/defaultvr',
|
|
success: res => {
|
|
if (res.code == 0) {
|
|
if (res.data?.title) {
|
|
uni.setNavigationBarTitle({
|
|
title: res.data.title
|
|
});
|
|
}
|
|
this.src = res.data.url
|
|
}
|
|
},
|
|
fail: res => {
|
|
}
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.vr-page {
|
|
height: 100vh;
|
|
width: 100%;
|
|
background: #fff;
|
|
}
|
|
|
|
.vr-webview {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|