欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序tabbar底部導(dǎo)航

 更新時(shí)間:2018年11月05日 08:37:39   作者:Arrogance-亓  
這篇文章主要為大家詳細(xì)介紹了微信小程序重寫tabbar底部導(dǎo)航,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

微信小程序重寫tabbar底部導(dǎo)航,供大家參考,具體內(nèi)容如下

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: "首頁(yè)"
    }, {
      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: "工作臺(tái)",
        iconPath: "/pages/images/gzt@3x.png",
        selectedIconPath: "/pages/images/gztxz@3x.png",
        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;
}

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

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

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

@import "template.wxss";

在需要的js頁(yè)面添加如下代碼:

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

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • JavaScript獲取時(shí)區(qū)實(shí)現(xiàn)過程解析

    JavaScript獲取時(shí)區(qū)實(shí)現(xiàn)過程解析

    這篇文章主要介紹了JavaScript獲取時(shí)區(qū)實(shí)現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-09-09
  • Webpack4+Babel7+ES6兼容IE8的實(shí)現(xiàn)

    Webpack4+Babel7+ES6兼容IE8的實(shí)現(xiàn)

    這篇文章主要介紹了Webpack4+Babel7+ES6兼容IE8的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 基于javascript處理二進(jìn)制圖片流過程詳解

    基于javascript處理二進(jìn)制圖片流過程詳解

    這篇文章主要介紹了基于javascript處理二進(jìn)制圖片流過程詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-06-06
  • 基于Day.js更優(yōu)雅的處理JavaScript中的日期

    基于Day.js更優(yōu)雅的處理JavaScript中的日期

    Day.js它能夠幫助我們處理JavaScript中的日期,本文就詳細(xì)的介紹一下Day.js的具體使用,可以更簡(jiǎn)單的處理JavaScript中的日期和時(shí)間
    2021-09-09
  • javascript中函數(shù)作為參數(shù)調(diào)用的方法

    javascript中函數(shù)作為參數(shù)調(diào)用的方法

    這篇文章主要介紹了javascript中函數(shù)作為參數(shù)調(diào)用的方法,實(shí)例分析了函數(shù)作為操作調(diào)用的原理與相關(guān)技巧,需要的朋友可以參考下
    2015-02-02
  • 解決一個(gè)微信號(hào)同時(shí)支持多個(gè)環(huán)境網(wǎng)頁(yè)授權(quán)問題

    解決一個(gè)微信號(hào)同時(shí)支持多個(gè)環(huán)境網(wǎng)頁(yè)授權(quán)問題

    由于微信限制一個(gè)服務(wù)號(hào)只能配置一個(gè)網(wǎng)頁(yè)授權(quán)域名, 又不可能給每個(gè)環(huán)境單獨(dú)配一個(gè)服務(wù)號(hào),這樣不僅需要成本而且很浪費(fèi)資源,下面小編給大家?guī)?lái)了解決一個(gè)微信號(hào)同時(shí)支持多個(gè)環(huán)境網(wǎng)頁(yè)授權(quán)問題,感興趣的朋友一起看看吧
    2019-08-08
  • 使用electron實(shí)現(xiàn)百度網(wǎng)盤懸浮窗口功能的示例代碼

    使用electron實(shí)現(xiàn)百度網(wǎng)盤懸浮窗口功能的示例代碼

    這篇文章主要介紹了使用electron實(shí)現(xiàn)百度網(wǎng)盤懸浮窗口功能的示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來(lái)看看吧
    2018-10-10
  • JavaScript實(shí)現(xiàn)緩動(dòng)動(dòng)畫

    JavaScript實(shí)現(xiàn)緩動(dòng)動(dòng)畫

    這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)緩動(dòng)動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-11-11
  • select下拉框插件jquery.editable-select詳解

    select下拉框插件jquery.editable-select詳解

    本篇文章主要介紹了select下拉框插件jquery.editable-select。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧
    2017-01-01
  • 創(chuàng)建一般js對(duì)象的幾種方式

    創(chuàng)建一般js對(duì)象的幾種方式

    本文主要介紹了創(chuàng)建一般js對(duì)象的幾種方式。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧
    2017-01-01

最新評(píng)論