From b37dec20be1844a9210fb009a44a450c9f45857d Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 15 五月 2025 16:32:08 +0800 Subject: [PATCH] tabbar增加视频发布 --- components/custom-tabbar.vue | 42 +++++++++++++++++++++++++++--------------- 1 files changed, 27 insertions(+), 15 deletions(-) diff --git a/components/custom-tabbar.vue b/components/custom-tabbar.vue index c7e2139..a483f52 100644 --- a/components/custom-tabbar.vue +++ b/components/custom-tabbar.vue @@ -5,13 +5,13 @@ v-for="(item, index) in list" :key="index" class="tabbar-item" - @click="switchTab(item, index)" + @click="switchTab(item)" > <image - :src="selected === index ? item.selectedIconPath : item.iconPath" - class="tabbar-icon" + :src="selected === item.key ? item.selectedIconPath : item.iconPath" + :class="{'tabbar-icon': true, 'video-add': item.key == 'video'}" /> - <text class="tabbar-text" :style="{color: selected === index ? selectedTextColor : color}"> + <text class="tabbar-text" v-if="item.text" :style="{color: selected === item.key ? selectedTextColor : color}"> {{item.text}} </text> </view> @@ -23,8 +23,8 @@ name: "CustomTabbar", props: { selected: { - type: Number, - default: 0 + type: String, + default: 'index' }, bgColor: { type: String, @@ -43,34 +43,43 @@ "pagePath": "/pages/tabbar/index/home", "iconPath": "/static/tabbar/home.png", "selectedIconPath": "/static/tabbar/home-s.png", - "text": "棣栭〉" + "text": "棣栭〉", + "key": 'index' }, { "pagePath": "/pages/tabbar/category/category", "iconPath": "/static/tabbar/category.png", "selectedIconPath": "/static/tabbar/category-s.png", - "text": "鍒嗙被" + "text": "鍟嗗煄", + "key": 'shop' }, - + { + "pagePath": "/pages/tabbar/video/video", + "iconPath": "/static/tabbar/video.png", + "selectedIconPath": "/static/tabbar/video-selected.png", + "key": 'video' + }, { "pagePath": "/pages/tabbar/cart/cartList", "iconPath": "/static/tabbar/cart.png", "selectedIconPath": "/static/tabbar/cart-s.png", - "text": "璐墿杞�" + "text": "璐墿杞�", + "key": 'buyCar' }, { "pagePath": "/pages/tabbar/user/my", "iconPath": "/static/tabbar/mine.png", "selectedIconPath": "/static/tabbar/mine-s.png", - "text": "鎴戠殑" + "text": "鎴戠殑", + "key": 'my' } ] } }, methods: { - switchTab(item, index) { - console.log("鎵ц鍔�", item, index); - if (this.selected === index) return; + switchTab(item) { + console.log("鎵ц鍔�", item); + if (this.selected === item.key) return; uni.switchTab({ url: item.pagePath }); @@ -99,7 +108,10 @@ align-items: center; justify-content: center; } - +.video-add { + width: 30px !important; + height: 30px !important; +} .tabbar-icon { width: 24px; height: 24px; -- Gitblit v1.8.0