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/mine/activity/reportActivity.vue | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pages/mine/activity/reportActivity.vue b/pages/mine/activity/reportActivity.vue index b035663..017f929 100644 --- a/pages/mine/activity/reportActivity.vue +++ b/pages/mine/activity/reportActivity.vue @@ -1,7 +1,7 @@ <template> <view class="wrapper"> - - + <top-bar selectedTitleIndex="activity" @changeTab="topBarChange" class="topBar"></top-bar> + <view style="height: 100rpx"></view> <!-- 鍐呭鍖哄煙 --> <scroll-view scroll-y class="content" style="height: 40vh;" @scrolltolower="loadMore" :lower-threshold="100"> @@ -47,9 +47,11 @@ </template> <script> + import TopBar from "@/components/TopBar.vue"; import '@/components/uview-components/uview-ui'; import {getActivityReportList} from '@/api/activity.js'; export default { + components: {TopBar}, data() { return { columns: [ @@ -74,6 +76,17 @@ this.getActivityList(); }, methods: { + topBarChange(titleObj) { + if (titleObj.index === 'home') { + uni.switchTab({ + url: titleObj.pagePath + }); + } else { + uni.redirectTo({ + url: titleObj.pagePath + }); + } + }, /** * 涓嬫媺鍒锋柊鏃� */ @@ -367,4 +380,10 @@ font-size: 28rpx; } } -</style> \ No newline at end of file + .topBar { + position: fixed; + top: 20rpx; + left: 20rpx; + z-index: 1000 + } +</style> -- Gitblit v1.8.0