From a70a29eda1a74ee27d6326e74f267a9ae205c2d9 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Sat, 25 Jul 2026 17:10:32 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages_tool/vr/index.vue | 62 +++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/pages_tool/vr/index.vue b/pages_tool/vr/index.vue index 9fc0e49..2c8e104 100644 --- a/pages_tool/vr/index.vue +++ b/pages_tool/vr/index.vue @@ -1,6 +1,6 @@ @@ -9,45 +9,53 @@ export default { data() { return { src: '', - title: '' + title: '', + titleTimer: null }; }, onLoad(option) { - this.title = option?.title ?? ''; - this.$api.sendRequest({ - url: '/api/config/defaultvr', - success: res => { - if (res.code == 0) { - this.src = res.data.url; - this.title = res.data.title; - } - }, + this.title = option?.title || '工厂展示'; + uni.setNavigationBarTitle({ title: this.title }); + this.$api.sendRequest({ + url: '/api/config/defaultvr', + success: res => { + if (res.code == 0) { + this.title = res.data.title; + uni.setNavigationBarTitle({ title: this.title }); + this.src = res.data.url; + this.startTitleGuard(); + } + }, fail: res => { } }); }, onShow() { - if (this.title) { - uni.setNavigationBarTitle({ title: this.title }); - } - }, - watch: { - title(newVal) { - if (newVal) { - uni.setNavigationBarTitle({ title: newVal }); - } - } - }, - methods: { - onWebViewLoad() { if (this.title) { - setTimeout(() => { + uni.setNavigationBarTitle({ title: this.title }); + } + }, + + methods: { + startTitleGuard() { + this.clearTitleGuard(); + let count = 0; + this.titleTimer = setInterval(() => { uni.setNavigationBarTitle({ title: this.title }); + count++; + if (count >= 10) { + this.clearTitleGuard(); + } }, 100); + }, + clearTitleGuard() { + if (this.titleTimer) { + clearInterval(this.titleTimer); + this.titleTimer = null; + } } } - } -}; + };