From df4dd9f030ac4e830d93f2f64e2379a9b7dad278 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 25 六月 2025 20:41:20 +0800
Subject: [PATCH] 自定义顶部组件、顶部tab对应页面接入该组件

---
 pages/tabbar/index/home.vue |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index a2cf82d..4e2f810 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -1,5 +1,6 @@
 <template>
   <view class="video-container">
+	<top-bar selectedTitleIndex="home" @changeTab="topBarChange" class="topBar"></top-bar>
 	<!-- 瑙嗛鍔犺浇 -->
 	<zero-loading v-show="videoLoading" type="circle" color="#0ebd57" text=""></zero-loading>
     <!-- 瑙嗛鍒楄〃 -->
@@ -247,7 +248,10 @@
 import { silentLogin } from "@/api/connect.js";
 import { getUserInfo } from "@/api/members";
 import storage from "@/utils/storage.js";
+import TopBar from "@/components/TopBar.vue";
+
 export default {
+  components: {TopBar},
   computed: {
 	    hasPlayTime() {
 	      return this.sliderFormatTime(this.progress > 0 ? this.duration * this.progress / 100 : 0);
@@ -379,6 +383,17 @@
   	}
   },
   methods: {
+	  topBarChange(titleObj) {
+		if (titleObj.index === 'home') {
+			uni.switchTab({
+				url: titleObj.pagePath
+			});
+		} else {
+			uni.redirectTo({
+				url: titleObj.pagePath
+			});
+		}
+	  },
 	  // 闈欓粯鐧诲綍
 	  wxSilentLogin(callback) {
 		  //鑾峰彇code
@@ -1361,4 +1376,10 @@
 	.custom-share-btn::after {
 	  border: none;
 	}
+	.topBar {
+		position: fixed;
+		top: 20rpx;
+		left: 20rpx;
+		z-index: 1000
+	}
 </style>

--
Gitblit v1.8.0