麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 課堂 > 小程序 > 正文

微信小程序tabbar底部導航

2020-03-21 16:07:37
字體:
來源:轉載
供稿:網友

微信小程序重寫tabbar底部導航,供大家參考,具體內容如下

1.app.js代碼如下:

 editTabBar: function() {    var e = this.globalData.tabbar, a = getCurrentPages(), t = a[a.length - 1], s = t.__route__;    0 != s.indexOf("/") && (s = "/" + s);    for (var n in e.list) e.list[n].selected = !1, e.list[n].pagePath == s && (e.list[n].selected = !0);    t.setData({      tabbar: e    });  },  tabBar: {    color: "#123",    selectedColor: "#1ba9ba",    borderStyle: "#1ba9ba",    backgroundColor: "#fff",    list: [ {      pagePath: "/we7/pages/index/index",      iconPath: "/we7/resource/icon/home.png",      selectedIconPath: "/we7/resource/icon/homeselect.png",      text: "首頁"    }, {      pagePath: "/we7/pages/user/index/index",      iconPath: "/we7/resource/icon/user.png",      selectedIconPath: "/we7/resource/icon/userselect.png",      text: "我的"    } ]  },  globalData: {    userInfo: null,    tabbar: {      color: "#333",      selectedColor: "#d0501f",      backgroundColor: "#ffffff",      borderStyle: "#d5d5d5",      list: [ {        pagePath: "/pages/seller/gzt",        text: "工作臺",        iconPath: "/pages/images/[email protected]",        selectedIconPath: "/pages/images/[email protected]",        selected: !0      }, {        pagePath: "/pages/seller/cp/cplb",        text: "商品",        iconPath: "/pages/images/dbdc.png",        selectedIconPath: "/pages/images/dbdcxz.png",        selected: !1      },       position: "bottom"    }  },

template.wxml

<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.list.length*100}}%; color:{{item.selected?tabbar.selectedColor:tabbar.color}}" url="{{item.pagePath}}" wx:for="{{tabbar.list}}" wx:key="index">      <image class="tabbar_icon" src="{{item.selected?item.selectedIconPath:item.iconPath}}"></image>      <text>{{item.text}}</text>    </navigator>  </view></template>

3.template.wxss

 

.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;}

在需要用的頁面(wxml)添加如下代碼

<import src="template.wxml"></import> 
<template is="tabbar" data="{{tabbar:tabbar}}"></template>

在需要的樣式(wxss)添加如下代碼

@import "template.wxss";

在需要的js頁面添加如下代碼:

var dsq, app = getApp();添加在頂部
tabbar: {},在data中添加
app.editTabBar();在onLoad中添加

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美黄 片免费观看 | 欧美日韩中文字幕在线视频 | 久久久久免费精品国产小说色大师 | 最新在线中文字幕 | 亚洲成人在线视频网 | 他也色在线视频 | 欧美三级一级 | 黄色片网站免费看 | 99日韩精品视频 | 中文在线观看www | 久久精品国产99国产精品澳门 | 国产正在播放 | 成人免费一区二区 | omofun 动漫在线观看 | 黄色一级片免费在线观看 | 国产色片在线观看 | 亚洲 综合 欧美 动漫 丝袜图 | 亚洲精品成人在线视频 | 91网在线播放| 色交视频 | 狠狠色噜噜狠狠狠米奇9999 | 久久成年网站 | 欧美精品18videos性欧美 | 偿还电影免费看 | 成人午夜免费观看 | 中文字幕免费在线看 | 国产一有一级毛片视频 | 国内xxxx乱子另类 | 成人在线视频一区 | 91在线色视频| 成人福利网 | 超碰97国产在线 | 草久在线观看视频 | 国产精选在线 | 九九黄色 | 欧美一级特黄特色大片免费 | 91九色蝌蚪国产 | 草b视频在线观看 | 深夜影院一级毛片 | 美女黄色影院 | 一区二区三区四区高清视频 |