ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

支付宝底部选项卡

2019-07-13 11:51:25  阅读:240  来源: 互联网

标签:box 支付宝 选项卡 ms flex items 底部 tabbar webkit


支付宝小程序
app.js中代码如下
editTabBar: function () {
var e = this.globalData.tabbar, a = getCurrentPages(), t = a[a.length - 1], s = t.route;
console.log(t)
console.log(s)
0 != s.indexOf("/") && (s = "/" + s);
for (var n in e.items) e.items[n].selected = !1, e.items[n].pagePath == s && (e.items[n].selected = !0);
t.setData({
tabbar: e
});
},
globalData: {
userInfo: null,
//配置tabbar
tabbar: {
textColor: "#333",
selectedColor: "#d0501f",
backgroundColor: "#ffffff",
borderStyle: "#d5d5d5",
items: [{
pagePath: "/pages/seller/gzt/gzt",
name: "工作台",
icon: "/pages/icon/index.png",
activeIcon: "/pages/icon/index_1.png",
selected: !0
},{
pagePath: "/pages/seller/shezhi/shezhi",
name: "设置",
icon: "/pages/images/sz@3x.png",
activeIcon: "/pages/images/xzsz.png",
selected: !1
}],
position: "bottom"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
template.axml代码如下
<template name="tabbar">
<view class="tabbar_box" style="background-color:{{tabbar.backgroundColor}}; border-top-color:{{tabbar.borderStyle}}; {{tabbar.position=='top'?'top:0':'bottom:0'}}">
<navigator class="tabbar_nav" openType="redirect" style="width:{{1/tabbar.items.length*100}}%; color:{{item.selected?tabbar.selectedColor:tabbar.textColor}}" url="{{item.pagePath}}" a:for="{{tabbar.items}}" a:key="index">
<image class="tabbar_icon" src="{{item.selected?item.activeIcon:item.icon}}"></image>
<text>{{item.name}}</text>
</navigator>
</view>
</template>
1
2
3
4
5
6
7
8
9
template.acssl代码如下
.tabbar_box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-pack: distribute;
justify-content: space-around;
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
width: 100%;
height: 100rpx;
border-top: 0.5rpx solid #d5d5d5;
}

.tabbar_nav {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
font-size: 25rpx;
height: 100%;
}

.tabbar_icon {
width: 40rpx;
height: 40rpx;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
4.在需要引入的页面(.axml)中

- <import src="../template.axml"></import>
<template is="tabbar" data="{{tabbar:tabbar}}"></template>
1
2
3
5.在需要引入的样式(acss)中

@import "../template.acss";
1
6.在需要引入的js中

var app=getApp(); //放在顶部
tabbar:{}, //放在data中
app.editTabBar(); //放在onLoad中

标签:box,支付宝,选项卡,ms,flex,items,底部,tabbar,webkit
来源: https://www.cnblogs.com/zoujinhua/p/11180010.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有