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

小程序?qū)崿F(xiàn)tab標(biāo)簽頁(yè)

 更新時(shí)間:2020年11月16日 09:30:33   作者:路癡不臉盲  
這篇文章主要為大家詳細(xì)介紹了小程序?qū)崿F(xiàn)tab標(biāo)簽頁(yè),可點(diǎn)擊切換,滑動(dòng)切換頁(yè)面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了小程序?qū)崿F(xiàn)tab標(biāo)簽頁(yè)的具體代碼,供大家參考,具體內(nèi)容如下

頁(yè)面效果:

HTML:

<view wx:if="{{userType==0}}" style="height:100%">
 <view class="tab_box" style="width: 100%">
 <view class="tabs_v">
 <block wx:for="{{tabs}}" wx:for-item="item" wx:key="index">
  <view class="tab_v {{index<1?'tab_nature':'tab_course'}}" bindtap='changeCurrentTab_' data-index='{{index}}'
  data-current='{{index}}'>
  <text class="tab_txt {{currentTab==index? 'tab_v_active' : ''}}">{{item.label}}</text>
  </view>
 </block>
 </view>
 </view>
 <!-- tab 容器 -->
 <view class="tabWrap">
 <swiper class="" current="{{currentTab}}" duration="300" bindchange="swiperTab" style="width:100%;height:100%;">
 <!-- 頁(yè)面1 -->
 <block>
  <swiper-item style="width:100%;height:100%;">
  <view class="" style="width:100%;height:100%;">
  <scroll-view style="width:100%;height:100%;" scroll-y="true" bindscrolltolower='scrollToLower'
  bindscrolltoupper='scrollToUpper' lower-threshold='30' upper-threshold='30'>
  <view style="width:100%;height:auto;">
   頁(yè)面1
  </view>
  </scroll-view>
  </view>
  </swiper-item>
 </block>
 <!-- 頁(yè)面2 -->
 <block>
  <swiper-item style="width:100%;height:100%;">
  <view class="" style="width:100%;height:100%;">
  <scroll-view style="width:100%;height:100%;" scroll-y="true" bindscrolltolower='scrollToLower'
  bindscrolltoupper='scrollToUpper' lower-threshold='30' upper-threshold='30'>
  <view style="width:100%;height:auto;">
   頁(yè)面2
  </view>
  </scroll-view>
  </view>
  </swiper-item>
 </block>
 </swiper>
 </view>
</view>

CSS:

/* tab */
.tab_box{
 height: 50px;
 display: flex;
 flex-direction: row;
 background-color: #fff;
 border-bottom: 1px solid #E5E5E5;
 margin-bottom: 15px;
}
.tabs_v{
 width: 100%;
 display: flex;
 flex-direction: row;
 justify-content: space-between;
 align-items: center;
}
.tab_v{
 width: 50%;
 text-align: center;
}
.tab_txt{
 border-bottom: 2px solid transparent;
 padding-bottom: 14px;
 color: #999999;
}
.tab_v_active{
 border-bottom: 2px solid #00C6AC;
 color: #00C6AC;
 font-weight: bold;
}
/* 容器 */
.tabWrap{
 width: 100%;
 height: calc(100% - 67px);
 position: relative;
 border-bottom: 1px solid #e6e6e6;
}

JS:

Page({
 
 /**
 * 頁(yè)面的初始數(shù)據(jù)
 */
 data: {
 tabs: [
 {label:'訪客', index: 0},
 {label:'工作人員', index: 1}
 ],
 currentTab:0
 },
 /**
 * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載
 */
 onLoad: function (options) {
 },
 
 /**
 * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面初次渲染完成
 */
 onReady: function () {
 
 },
 
 /**
 * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面顯示
 */
 onShow: function () {
 
 },
 
 // tab切換
 changeCurrentTab_(e){
 let that = this
 if (that.data.currentTab === e.currentTarget.dataset.current){
 return false
 }else{
 that.setData({ 
 currentTab: e.currentTarget.dataset.current
 })
 }
 },
 //滑動(dòng)切換
 swiperTab: function (e) {
 var that = this;
 that.setData({
 currentTab: e.detail.current
 });
 }
})

為大家推薦現(xiàn)在關(guān)注度比較高的微信小程序教程一篇:《微信小程序開(kāi)發(fā)教程》小編為大家精心整理的,希望喜歡。

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

相關(guān)文章

  • 10道典型的JavaScript面試題

    10道典型的JavaScript面試題

    本文主要介紹了10道典型的JavaScript面試題。具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧
    2017-03-03
  • 頁(yè)面版文本框智能提示JS代碼

    頁(yè)面版文本框智能提示JS代碼

    首先說(shuō)下背景,該code用于一個(gè)多條件查詢界面,原本該查詢條件由一個(gè)下拉列表提供,但是由于下拉列表數(shù)據(jù)量過(guò)大,用戶使用不方便,便希望在頁(yè)面給出一個(gè)智能提示的功能,但搜索的數(shù)據(jù)來(lái)自下拉列表
    2009-11-11
  • BootStrap中Table分頁(yè)插件使用詳解

    BootStrap中Table分頁(yè)插件使用詳解

    bootstrap-table 是一個(gè)輕量級(jí)的table插件,使用AJAX獲取JSON格式的數(shù)據(jù),其分頁(yè)和數(shù)據(jù)填充很方便,支持國(guó)際化。這篇文章介紹了bootstrap中table分頁(yè)插件的使用,感興趣的朋友一起看看吧
    2016-10-10
  • JS獲取年月日時(shí)分秒的方法分析

    JS獲取年月日時(shí)分秒的方法分析

    這篇文章主要介紹了JS獲取年月日時(shí)分秒的方法,結(jié)合實(shí)例形式分析了JS獲取具體時(shí)間的常犯錯(cuò)誤與相應(yīng)解決方法,需要的朋友可以參考下
    2016-11-11
  • 前端實(shí)現(xiàn)文本超出指定行數(shù)顯示"展開(kāi)"和"收起"效果詳細(xì)步驟

    前端實(shí)現(xiàn)文本超出指定行數(shù)顯示"展開(kāi)"和"收起"效果詳細(xì)步驟

    本文介紹如何使用JavaScript原生代碼實(shí)現(xiàn)文本折疊展開(kāi)效果,并提供方法指導(dǎo)如何在Vue或React等框架中修改實(shí)現(xiàn),詳細(xì)介紹了創(chuàng)建整體框架、設(shè)置樣式及利用JS控制元素的步驟,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-10-10
  • JS圖片預(yù)加載三種實(shí)現(xiàn)方法解析

    JS圖片預(yù)加載三種實(shí)現(xiàn)方法解析

    這篇文章主要介紹了JS圖片預(yù)加載三種實(shí)現(xiàn)方法解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-05-05
  • 微信小程序仿今日頭條導(dǎo)航欄滾動(dòng)解析

    微信小程序仿今日頭條導(dǎo)航欄滾動(dòng)解析

    這篇文章主要介紹了微信小程序仿今日頭條導(dǎo)航欄滾動(dòng)解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-08-08
  • range 標(biāo)準(zhǔn)化之獲取

    range 標(biāo)準(zhǔn)化之獲取

    range 是用戶選擇區(qū)域的唯一表示方法,存在 w3c 的標(biāo)準(zhǔn)化 range ,以及 ie 特有的 textrange 與 controlrange ,相對(duì)于 ie ,w3c 的概念更易于理解,首先簡(jiǎn)要介紹一下 w3c range.
    2011-08-08
  • 讓JavaScript擁有類(lèi)似Lambda表達(dá)式編程能力的方法

    讓JavaScript擁有類(lèi)似Lambda表達(dá)式編程能力的方法

    在前幾天的博文中我發(fā)布了一個(gè)可以自定義頁(yè)碼呈現(xiàn)方式的組件,有C#和JavaScript兩個(gè)版本。
    2010-09-09
  • javascript函數(shù)以及基礎(chǔ)寫(xiě)法100多條實(shí)用整理

    javascript函數(shù)以及基礎(chǔ)寫(xiě)法100多條實(shí)用整理

    100多個(gè)很有用的JavaScript函數(shù)以及基礎(chǔ)寫(xiě)法匯總,在項(xiàng)目開(kāi)發(fā)中經(jīng)常會(huì)使用到,本文整理了一些,希望對(duì)你們有幫助
    2013-01-01

最新評(píng)論