From 6ac775ef661885e175b82a7be5b76d8f34ede8e2 Mon Sep 17 00:00:00 2001 From: taiwan Date: Fri, 14 Jan 2022 16:53:49 +0800 Subject: [PATCH] 自定义tabbar修改 --- custom-tab-bar/index.js | 27 +++++++++++++++++++++++---- custom-tab-bar/index.wxml | 50 +++++++++++++++++++++++++++++--------------------- custom-tab-bar/index.wxss | 24 ++++++++++++++++++++---- 3 files changed, 72 insertions(+), 29 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index e229a34..ad7d3e8 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -5,13 +5,14 @@ Component({ fontcolor:'#6e6d6b', fontcolor_sele:'#f23030', backgroundColor:'#ffffff', - active:-1, list:app.def_list, cartGoodsNum:0, + active: 0, }, lifetimes: { attached: function() { + var th=this; getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ var dis=rs.data.data; @@ -51,7 +52,8 @@ Component({ var th=this; var is_read=getApp().globalData.is_read; - var custum_data=getApp().globalData.custum_data; + var custum_data=getApp().globalData.custum_data; + if(is_read){ if(custum_data){ this.set_list(custum_data); @@ -105,16 +107,33 @@ Component({ fontcolor:data.fontcolor, is_custum:1 }) - + // console.log('abc=======<<<<<', this.data.list); }, nav_goto:function(e){ + // const data = e.currentTarget.dataset + // this.setData({ + // active: data.index + // }) + // console.log('active***********<<<<<', this.data.active); var url=e.currentTarget.dataset.url; if(!url) return false; if(url[0]!='/') url='/'+url; //wx.switchTab({url:url,}) getApp().goto(url); - } + }, + + + // switchTab(e) { + // const data = e.currentTarget.dataset + // const url = data.path + // wx.switchTab({url}) + // this.setData({ + // selected: data.index + // }) + // } + + } diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index cfe266f..0c417bb 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,32 +1,40 @@ - - - - - - - {{cartGoodsNum}} - - - {{item.nav_name}} - - - + + + + + + + + {{cartGoodsNum}} + + + {{item.nav_name}} + + + + + + + - - - - {{item.nav_name}} - + + + + + {{item.nav_name}} + + + - + diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index 71558c6..eb2618d 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -7,6 +7,7 @@ z-index: 10000; display: flex; justify-content: space-around; + align-items: center; height: 100rpx; } .main_bar.custom { @@ -19,14 +20,14 @@ /* float: left; */ text-align: center; padding: 0; - display: flex; + /* display: flex; */ flex: 1; - flex-direction: column; - justify-content: center; + /* flex-direction: column; */ + /* justify-content: center; */ } .tab_img { - display: flex; + /* display: flex; */ justify-content: center; position: relative; } @@ -39,6 +40,7 @@ /* background-position: center; background-repeat: no-repeat; */ background-size: 100%; + margin: 0 auto; } .cart_num { @@ -55,3 +57,17 @@ right: 34rpx; /* margin-right: -70rpx; */ } + +.tabbar_item_wrapper { + background-color: white; + position: relative; + width: 120rpx; + height: 120rpx; + border-radius: 50%; + bottom: 14rpx; + display: flex; + flex-direction: column; + justify-content: center; + margin: 0 auto; +} + -- libgit2 0.21.4