From b37dec20be1844a9210fb009a44a450c9f45857d Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 15 五月 2025 16:32:08 +0800 Subject: [PATCH] tabbar增加视频发布 --- static/tabbar/video.png | 0 pages/tabbar/user/my.vue | 2 pages/tabbar/video/video.vue | 22 +++++++++++ static/tabbar/video-selected.png | 0 pages.json | 16 +++++++- pages/tabbar/cart/cartList.vue | 2 pages/tabbar/category/category.vue | 2 components/custom-tabbar.vue | 42 +++++++++++++------- pages/tabbar/index/home.vue | 2 9 files changed, 67 insertions(+), 21 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; diff --git a/pages.json b/pages.json index ed4763f..95c0015 100644 --- a/pages.json +++ b/pages.json @@ -101,6 +101,14 @@ "style": { "navigationBarTitleText": "涓撻" } + }, + { + "path" : "pages/tabbar/video/video", + "style" : + { + "navigationBarTitleText" : "鍙戝竷瑙嗛", + "enablePullDownRefresh" : false + } } @@ -845,9 +853,13 @@ "pagePath": "pages/tabbar/category/category", "iconPath": "static/tabbar/category.png", "selectedIconPath": "static/tabbar/category-s.png", - "text": "鍒嗙被" + "text": "鍟嗗煄" }, - + { + "pagePath": "pages/tabbar/video/video", + "iconPath": "static/tabbar/video.png", + "selectedIconPath": "static/tabbar/video-selected.png" + }, { "pagePath": "pages/tabbar/cart/cartList", "iconPath": "static/tabbar/cart.png", diff --git a/pages/tabbar/cart/cartList.vue b/pages/tabbar/cart/cartList.vue index dce2147..aa47358 100644 --- a/pages/tabbar/cart/cartList.vue +++ b/pages/tabbar/cart/cartList.vue @@ -175,7 +175,7 @@ </view> </div> <u-toast ref="uToast" /> - <custom-tabbar bgColor="#ffffff" :selected="2"></custom-tabbar> + <custom-tabbar bgColor="#ffffff" selected="buyCar"></custom-tabbar> </view> </template> <script> diff --git a/pages/tabbar/category/category.vue b/pages/tabbar/category/category.vue index 75bed5f..5ed9a6f 100644 --- a/pages/tabbar/category/category.vue +++ b/pages/tabbar/category/category.vue @@ -36,7 +36,7 @@ </view> </scroll-view> </view> - <custom-tabbar bgColor="#ffffff" :selected="1"></custom-tabbar> + <custom-tabbar bgColor="#ffffff" selected="shop"></custom-tabbar> </view> </template> diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue index 6e9643b..bbbe33b 100644 --- a/pages/tabbar/index/home.vue +++ b/pages/tabbar/index/home.vue @@ -81,7 +81,7 @@ </view> </swiper-item> </swiper> - <custom-tabbar bgColor="#333333" :selected="0" selectedTextColor="#ffffff"></custom-tabbar> + <custom-tabbar bgColor="#333333" selected="index" selectedTextColor="#ffffff"></custom-tabbar> </view> </template> diff --git a/pages/tabbar/user/my.vue b/pages/tabbar/user/my.vue index 62a836b..6734f28 100644 --- a/pages/tabbar/user/my.vue +++ b/pages/tabbar/user/my.vue @@ -71,7 +71,7 @@ <!-- 甯哥敤宸ュ叿 --> <tool /> - <custom-tabbar bgColor="#ffffff" :selected="3"></custom-tabbar> + <custom-tabbar bgColor="#ffffff" selected="my"></custom-tabbar> </view> </template> <script> diff --git a/pages/tabbar/video/video.vue b/pages/tabbar/video/video.vue new file mode 100644 index 0000000..9c11087 --- /dev/null +++ b/pages/tabbar/video/video.vue @@ -0,0 +1,22 @@ +<template> + <view> + <custom-tabbar bgColor="#ffffff" selected="video"></custom-tabbar> + </view> +</template> + +<script> + export default { + data() { + return { + + } + }, + methods: { + + } + } +</script> + +<style> + +</style> diff --git a/static/tabbar/video-selected.png b/static/tabbar/video-selected.png new file mode 100644 index 0000000..bdacf06 --- /dev/null +++ b/static/tabbar/video-selected.png Binary files differ diff --git a/static/tabbar/video.png b/static/tabbar/video.png new file mode 100644 index 0000000..35b80c0 --- /dev/null +++ b/static/tabbar/video.png Binary files differ -- Gitblit v1.8.0