Commit 94d229bad8a75ebf46ad3d3149d60b471d65c579
1 parent
16474176
底部导航优化
Showing
5 changed files
with
10 additions
and
65 deletions
pages/cart/cart/cart.js
... | ... | @@ -1300,20 +1300,7 @@ Page({ |
1300 | 1300 | var prom_id=e.currentTarget.dataset.prom_id; |
1301 | 1301 | var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; |
1302 | 1302 | getApp().goto(url); |
1303 | - }, | |
1304 | - | |
1305 | - load_nav(e){ | |
1306 | - var $width=e.detail.width, //获取图片真实宽度 | |
1307 | - $height=e.detail.height, | |
1308 | - ratio=$width/$height; //图片的真实宽高比例 | |
1309 | - var viewHeight=52, //设置图片显示宽度,左右留有16rpx边距 | |
1310 | - viewWidth=viewHeight*ratio; //计算的高度值 | |
1311 | - var image=this.data.tabBar.list[e.target.dataset.index]; | |
1312 | - //将图片的datadata-index作为image对象的key,然后存储图片的宽高值 | |
1313 | - image.width=viewWidth; | |
1314 | - this.setData({ | |
1315 | - ['tabBar.list['+e.target.dataset.index+']']:image | |
1316 | - }) | |
1317 | 1303 | } |
1318 | 1304 | |
1305 | + | |
1319 | 1306 | }); |
1320 | 1307 | \ No newline at end of file | ... | ... |
pages/goods/categoryList/categoryList.js
... | ... | @@ -961,19 +961,6 @@ Page({ |
961 | 961 | var ob = { "card_list": new_arr, "name_map": card_name_map }; |
962 | 962 | func(ob); |
963 | 963 | }) |
964 | - }, | |
964 | + } | |
965 | 965 | |
966 | - load_nav(e){ | |
967 | - var $width=e.detail.width, //获取图片真实宽度 | |
968 | - $height=e.detail.height, | |
969 | - ratio=$width/$height; //图片的真实宽高比例 | |
970 | - var viewHeight=52, //设置图片显示宽度,左右留有16rpx边距 | |
971 | - viewWidth=viewHeight*ratio; //计算的高度值 | |
972 | - var image=this.data.tabBar.list[e.target.dataset.index]; | |
973 | - //将图片的datadata-index作为image对象的key,然后存储图片的宽高值 | |
974 | - image.width=viewWidth; | |
975 | - this.setData({ | |
976 | - ['tabBar.list['+e.target.dataset.index+']']:image | |
977 | - }) | |
978 | - } | |
979 | 966 | }); |
980 | 967 | \ No newline at end of file | ... | ... |
pages/index/index/index.js
... | ... | @@ -827,23 +827,7 @@ Page({ |
827 | 827 | is_disgraceful: 1 |
828 | 828 | }) |
829 | 829 | }) |
830 | - }, | |
831 | - | |
832 | - load_nav(e){ | |
830 | + } | |
833 | 831 | |
834 | - var $width=e.detail.width, //获取图片真实宽度 | |
835 | - $height=e.detail.height, | |
836 | - ratio=$width/$height; //图片的真实宽高比例 | |
837 | - var viewHeight=52, //设置图片显示宽度,左右留有16rpx边距 | |
838 | - viewWidth=viewHeight*ratio; //计算的高度值 | |
839 | - var image=this.data.tabBar.list[e.target.dataset.index]; | |
840 | - if(image.width) return fasle; | |
841 | 832 | |
842 | - //将图片的datadata-index作为image对象的key,然后存储图片的宽高值 | |
843 | - image.width=viewWidth; | |
844 | - this.setData({ | |
845 | - ['tabBar.list['+e.target.dataset.index+']']:image | |
846 | - }) | |
847 | - } | |
848 | - | |
849 | 833 | }); |
850 | 834 | \ No newline at end of file | ... | ... |
pages/tabbar/tabbar.wxml
... | ... | @@ -2,16 +2,16 @@ |
2 | 2 | <!--pages/tabbar.wxml--> |
3 | 3 | <template name="tabBar"> |
4 | 4 | <!-- 如果是自定义的话 --> |
5 | - <view hidden="{{tabBar.iscustom=='2'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '168rpx' : '100rpx'}};position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; bottom: 0;z-index:9999999;"> | |
5 | + <view hidden="{{tabBar.iscustom=='2'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '172rpx' : '104rpx'}};position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; bottom: 0;z-index:9999999;"> | |
6 | 6 | <block wx:for="{{tabBar.list}}" wx:key="weappurl"> |
7 | - | |
8 | 7 | <block wx:if="{{!item.active}}"> |
9 | 8 | <navigator url="{{item.weappurl}}" open-type="redirect" class="tabbar_item {{item.clas}}" style="position:relative;width:{{100 / tabBar.length}}%;height:100%;float:left;text-align:center;padding:5px 0;"> |
10 | 9 | <view wx:if="{{item.nav_name=='购物车'}}" style="top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx;"> |
11 | 10 | {{tabBar.cartGoodsNum}} |
12 | 11 | </view> |
13 | - <view style="width:35%;height:54rpx;margin-left:33%;"> | |
14 | - <image src="{{item.src}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%; width:{{item.width?item.width:0}}rpx;height:52rpx"></image> | |
12 | + <view style="width:35%;height:58rpx;margin-left:33%;display: flex; justify-content: center;align-items: center"> | |
13 | + <!--<image src="{{item.src}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%; width:{{item.width?item.width:0}}rpx;height:{{item.height}}rpx"></image>--> | |
14 | + <view class="nav_imgage" style="background-image: url({{item.src}});height: 50rpx; width: 50rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%;"></view> | |
15 | 15 | </view> |
16 | 16 | <view style="height:20px;line-height:15px; position: relative; top: -8rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view> |
17 | 17 | </navigator> |
... | ... | @@ -21,8 +21,9 @@ |
21 | 21 | <view wx:if="{{item.nav_name=='购物车'}}" style="top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx;"> |
22 | 22 | {{tabBar.cartGoodsNum}} |
23 | 23 | </view> |
24 | - <view style="width:35%;height:54rpx;margin-left:33%;"> | |
25 | - <image src="{{item.src_sele}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%;width:{{item.width?item.width:0}}rpx;height:52rpx"></image> | |
24 | + <view style="width:35%;height:58rpx;margin-left:33%; display: flex; justify-content: center;align-items: center"> | |
25 | + <!--<image src="{{item.src_sele}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%;width:{{item.width?item.width:0}}rpx;height:{{item.height}}rpx"></image>--> | |
26 | + <view class="nav_imgage" style="background-image: url({{item.src_sele}});height: 50rpx; width: 50rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%;"></view> | |
26 | 27 | </view> |
27 | 28 | <view style="height:20px;line-height:15px; position: relative; top: -8rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view> |
28 | 29 | </view> | ... | ... |
pages/user/index/index.js
... | ... | @@ -638,20 +638,6 @@ Page({ |
638 | 638 | |
639 | 639 | } |
640 | 640 | }) |
641 | - }, | |
642 | - | |
643 | - load_nav(e){ | |
644 | - var $width=e.detail.width, //获取图片真实宽度 | |
645 | - $height=e.detail.height, | |
646 | - ratio=$width/$height; //图片的真实宽高比例 | |
647 | - var viewHeight=52, //设置图片显示宽度,左右留有16rpx边距 | |
648 | - viewWidth=viewHeight*ratio; //计算的高度值 | |
649 | - var image=this.data.tabBar.list[e.target.dataset.index]; | |
650 | - //将图片的datadata-index作为image对象的key,然后存储图片的宽高值 | |
651 | - image.width=viewWidth; | |
652 | - this.setData({ | |
653 | - ['tabBar.list['+e.target.dataset.index+']']:image | |
654 | - }) | |
655 | 641 | } |
656 | 642 | |
657 | 643 | ... | ... |