支付宝底部选项卡

支付宝小程序
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/[email protected]",
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中

原文地址:https://www.cnblogs.com/zoujinhua/p/11180010.html

时间: 2024-08-30 14:37:49

支付宝底部选项卡的相关文章

HTML5 开发APP(头部和底部选项卡)

我们开发app有一定固定的样式,比如头部和底部选项卡部分就是公共部分就比如我在做的app进来的主页面就像图片显示的那样 我们该怎么实现呢,实现我们应该建一个主页面index.html,然后建五个子页面,通过mui来实现切换功能. 在index的html部分写下这样的代码 <body> <header class="mui-bar mui-bar-nav" style="padding-right: 15px;background: #00be68;"

MUI组价五:开关、底部选项卡、9宫格和分页

1.switch(开关) mui提供了开关控件,点击滑动两种手势都可以对开关控件进行操作,UI如下:默认开关控件,带on/off文字提示,打开时为绿色背景,基本class类为.mui-switch..mui-switch-handle,DOM结构如下: <div class="mui-switch"> <div class="mui-switch-handle"></div> </div> 若希望开关默认为打开状态,只

FragmentTabHostBottomDemo【FragmentTabHost + Fragment实现底部选项卡】

版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 使用FragmentTabHost实现底部选项卡效果. 备注:该Demo主要是演示FragmentTabHost的一些设置和部分功能,实际中需要参考其他Demo. 效果图 代码分析 1.该Demo中采用的是FragmentTabHost的布局方案之一[命名为非常规布局写法]:[建议使用常规布局写法,见<FragmentTabHostTopDemo[FragmentTabHost固定宽度且居中]>] 2.未使用自定义的FragmentT

TabLayoutBottomDemo【TabLayout实现底部选项卡】

版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 使用TabLayout实现底部选项卡切换功能. 效果图 代码分析 1.演示固定模式的展现 2.演示自定义布局的实现 使用步骤 一.项目组织结构图 注意事项: 1.  导入类文件后需要change包名以及重新import R文件路径 2.  Values目录下的文件(strings.xml.dimens.xml.colors.xml等),如果项目中存在,则复制里面的内容,不要整个覆盖 二.导入步骤 引入依赖库 在APP的build.gra

vue2.0中使用mint ui做底部选项卡切换

首先在vue2.0中webpack中下载 mint ui 然后再main.js引入 这样就可以使用mint ui里面的布局组件了html部分(就是你要使用底部选项卡的部分) <!--底部选项卡--><mt-tab-container v-model="selected"> <mt-tab-container-item id="one"> one </mt-tab-container-item> <mt-tab-c

MUI底部选项卡链接跳转不了

问题描述: 用MUI例子中的选项卡,底部的导航只能实现div切换,链接无法跳转. 查看控制台,输出:Unable to preventDefault inside passive event listener due to target 的警告. 问题解决: 经检查相关资料,加入以下代码,即可解决问题. mui('body').on('tap','a',function(){document.location.href=this.href;}); 问题原因: MUI在选项卡中的文字中已说明: 通

031实现仿iPhone的底部选项卡

效果如下: ViewController.h 1 #import <UIKit/UIKit.h> 2 3 @interface ViewController : UITabBarController 4 @end ViewController.m 1 #import "ViewController.h" 2 #import "SampleScene.h" 3 4 @interface ViewController () 5 - (void)layoutU

基于HBuilder开发手机APP-主页/跳转页面/切换选项卡

  前  言 手机APP 前端语言的学习,顺带着学习制作手机APP,在这里跟大家分享一下,我的第一个手机APP,它的名字叫做你好,明天. 本APP是临摹手机上的QQ阅读制作,可以登录,查看小说一些简单的设计,由于刚接触许多东西需要慢慢的熟悉.完善,不足之处请各位见谅. 开篇 下载HBuilder在这里就不做太多阐述,直接进入主题. 1 建立新项目-手机APP 先来一个效果图镇楼: 当你新建完成之后会出现新的项目,创建的时候选择mui项目,里面会内带一些CSS与JS方便编写内容. 具体内容和主页如

MUI底部导航栏切换效果

首先是html代码: <nav class="mui-bar mui-bar-tab"> <a href="view/templates/home/home.html" class="mui-tab-item mui-active" id="defaultTab"> <span class="mui-icon iconfont icon-shouye"></span