Browse Source

标题0.5s后重新设置

xiaohaizhao 11 months ago
parent
commit
126d115d00
1 changed files with 39 additions and 29 deletions
  1. 39 29
      pages/picture/index.vue

+ 39 - 29
pages/picture/index.vue

@@ -1,40 +1,50 @@
 <template>
-	<view>
-		<web-view v-if="webSrc" :src="webSrc" @message="onPostMessage" />
-	</view>
+  <view>
+    <web-view v-if="webSrc" :src="webSrc" @message="onPostMessage" />
+  </view>
 </template>
 
 <script>
 export default {
-	data() {
-		return {
-			webSrc: ""
-		}
-	},
-	onLoad(options) {
-		/* encodeURIComponent(``) */
-		if (options.parems) this.webSrc = `http://61.164.207.46:8200/webviewtools/index.html#/pages/photoGallery/index?parems=${options.parems}&title=${options.title || '电子相册'}`;
-		if (options.title) uni.setNavigationBarTitle({
-			title: options.title
-		})
-	},
-	onUnload() {
-		this.$Http.innerAudioContext && this.$Http.innerAudioContext.destroy()
-	},
-	methods: {
-		onPostMessage(e) {
-			console.log("onPostMessage", e)
-		}
-	},
-}
+  data() {
+    return {
+      webSrc: "",
+    };
+  },
+  onLoad(options) {
+    /* encodeURIComponent(``) */
+    if (options.parems)
+      this.webSrc = `http://61.164.207.46:8200/webviewtools/index.html#/pages/photoGallery/index?parems=${
+        options.parems
+      }&title=${options.title || "电子相册"}`;
+    if (options.title) {
+      uni.setNavigationBarTitle({
+        title: options.title,
+      });
+      setTimeout(() => {
+        uni.setNavigationBarTitle({
+          title: options.title,
+        });
+      }, 500);
+    }
+  },
+  onUnload() {
+    this.$Http.innerAudioContext && this.$Http.innerAudioContext.destroy();
+  },
+  methods: {
+    onPostMessage(e) {
+      console.log("onPostMessage", e);
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .coverView {
-	position: fixed;
-	bottom: 10px;
-	left: 10px;
-	color: #fff;
-	z-index: 999999999;
+  position: fixed;
+  bottom: 10px;
+  left: 10px;
+  color: #fff;
+  z-index: 999999999;
 }
 </style>