From 36e794d948b856f2a542aaadd0e374892635be14 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 25 六月 2025 21:19:17 +0800 Subject: [PATCH] 自定义顶部组件优化 --- pages/mine/activity/reportActivity.vue | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-) diff --git a/pages/mine/activity/reportActivity.vue b/pages/mine/activity/reportActivity.vue index 1e9412b..4929634 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" textColor="black" @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,24 +47,11 @@ </template> <script> - import { - changeCollect - } from '@/api/collect.js' - import { - getFilePreviewUrl - } from '@/api/common.js' - import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; - import UImage from '@/uview-components/uview-ui/components/u-image/u-image.vue'; - import ULoadmore from '@/uview-components/uview-ui/components/u-loadmore/u-loadmore.vue' - import { - getActivityReportList, - } from '@/api/activity.js'; + import TopBar from "@/components/TopBar.vue"; + import '@/components/uview-components/uview-ui'; + import {getActivityReportList} from '@/api/activity.js'; export default { - components: { - UImage, - UButton, - ULoadmore - }, + components: {TopBar}, data() { return { columns: [ @@ -89,6 +76,17 @@ this.getActivityList(); }, methods: { + topBarChange(titleObj) { + if (titleObj.index === 'home') { + uni.switchTab({ + url: titleObj.pagePath + }); + } else { + uni.redirectTo({ + url: titleObj.pagePath + }); + } + }, /** * 涓嬫媺鍒锋柊鏃� */ @@ -382,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