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

小程序?qū)崿F(xiàn)點擊tab切換左右滑動

 更新時間:2020年11月16日 09:18:22   作者:bingxiaoxiao  
這篇文章主要為大家詳細介紹了小程序?qū)崿F(xiàn)點擊tab切換左右滑動,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了小程序?qū)崿F(xiàn)點擊tab切換左右滑動的具體代碼,供大家參考,具體內(nèi)容如下

wxml

<scroll-view scroll-x="true" class="navbar-box">
 <block wx:for="{{recordMain}}" wx:for-index="idx" wx:for-item="navItem" wx:key="idx">
 <view class="nav-item " data-current="{{idx}}" bindtap="switchNav">
  <text class="{{currentTab == idx ? 'active' : ''}}">{{navItem.title}}</text>
 </view>
 </block>
</scroll-view>

<swiper style="margin-top:80rpx;height:{{winHeight - 40}}px;" class="tab-box" current="{{currentTab}}" duration="300" data-current="{{idx}}" bindchange="switchTab">
 <swiper-item style="height:100%;overflow-y:scroll" wx:for="{{[0,1,2,3,4,5]}}" wx:for-item="tabItem" wx:for-index="idx" wx:key="idx" class="tab-cnetent">
 <block wx:for="{{tabContent}}" wx:key=" " bindtap='myOrderDetails'>
  <!-- 列表 -->
  <view class='listBox'> 
   <view class='listTop'>
   <image src='{{item.goodsImg}}' class='goodsImg'></image>
   <view class='infor'>
    <view class=''>
    <text class='name'>{{item.name}}</text>
    <text class='price'>¥{{item.price}}</text>
    </view>
    <view class=''>
    <text class='choose'>{{item.choose}}</text>
    <text class='number'>×{{item.number}}</text>
    </view>
   </view>
   </view>
   <view class='listBottom'>
   <view>共{{item.number}}件商品,合計:¥{{item.allPrice}}</view>
   <view class='status'>
    <button>查看物流</button>
    <button>確認收貨</button>
   </view>
   </view> 
  </view>
 </block>
 </swiper-item>
</swiper>

wxss

::-webkit-scrollbar {
 width: 0;
 height: 0;
 color: transparent;
}

.navbar-box {
 height: 70rpx;
 line-height: 70rpx;
 position: fixed;
 top: 0rpx;
 background: white
}

.nav-item {
 display: inline-block;
 width: 16.6%;
 text-align: center;
}

.nav-item text {
 padding-bottom: 10rpx;
}
 
page {
 background: #f2f2f2;
 font-size: 28rpx;
}

.active {
 color: #a53533;
 border-bottom: 4rpx solid #a53533;
 box-sizing: border-box;
}

.menu {
 font-size: 28rpx;
 width: 100%;
 /* overflow-x: scroll; */
 border-bottom: 20rpx solid #f2f2f2;
 padding: 30rpx 30rpx 0rpx 30rpx;
 box-sizing: border-box;
 display: flex;
 justify-content: space-between;
 position: fixed;
 top: 0rpx;
 z-index: 999;
 background: white;
}

.chooseNav {
 padding-bottom: 10rpx;
}

.listBox {
 padding: 30rpx;
 width: calc(100% - 60rpx);
 margin-left: 30rpx;
 margin-top: 30rpx;
 background: white;
 box-sizing: border-box;
 border-radius: 8rpx;
} 

.listTop {
 display: flex;
 justify-content: space-between;
}

.goodsImg {
 width: 200rpx;
 height: 200rpx;
 margin-right: 20rpx;
}

.infor {
 flex: 1;
 margin-top: 80rpx;
 font-size: 26rpx;
 color: #666;
}

.infor view {
 width: 100%;
 display: flex;
 justify-content: space-between;
}

.infor view:nth-of-type(2) {
 font-size: 24rpx;
}

.name, .choose {
 font-weight: 600;
 display: inline-block;
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
 width: 320rpx;
}

.price, .number {
 padding: 5rpx 10rpx;
 box-sizing: border-box;
}

.listBottom {
 text-align: right;
}

button::after {
 border: none;
}

.status button {
 display: inline-block;
 background: white;
 border: 1px solid #dedede;
 border-radius: 66rpx;
 font-size: 24rpx;
 margin-left: 20rpx;
 color: #666;
 padding: 0rpx 30rpx;
 box-sizing: border-box;
 height: 50rpx;
 line-height: 45rpx;
 margin-top: 20rpx;
}

wxjs

Page({ 
 data: {
 recordMain: [
  
  {
  title: "全部"
  },
  {
  title: "待付款"
  },
  {
  title: "待發(fā)貨"
  },
  {
  title: "待發(fā)貨"
  }, {
  title: "已完成"
  },
  {
  title: "已取消"
  },
 ],
 tabContent: [
  {
  goodsImg: '/img/goods.png',
  name: '阿莎瑪沙阿莎瑪沙發(fā)阿莎瑪沙發(fā)阿莎瑪沙發(fā)阿莎瑪沙莎瑪沙發(fā)發(fā)',
  price: "666",
  choose: '已選:全新,16期',
  number: '32',
  allPrice: '888'
  },
 ],
 currentTab: 0,
 navScrollLeft: 0,
 winWidth: 0,
 winHeight: 0, 
 },
 // 事件處理函數(shù)
 onLoad: function () {
 var that = this; 
 /** 獲取系統(tǒng)信息*/
 wx.getSystemInfo({
  success: function (res) {
  that.setData({
   winWidth: res.windowWidth,
   winHeight: res.windowHeight,
  });
  }
 });
 },
 // 滑動事件
 // 點擊標題切換當前頁時改變樣式
 switchNav:function(e) {
 console.log(e.currentTarget.dataset.current)
 var that = this
 var cur = e.currentTarget.dataset.current;
 if (that.data.currentTab == cur) {
  return false;
 } else {
  that.setData({
  currentTab: cur
  })
 }
 },
 // 滾動切換標簽樣式 
 switchTab: function(e) {
 console.log(e) 
 var that = this; 
 that.setData({
  currentTab: e.detail.current
 }); 

 if (e.detail.current == 0) {
  console.log(0)
 } 
 else if (e.detail.current == 1) {
  console.log(11)
 } 
 else if (e.detail.current == 2) {
  console.log(2222) 
 } 
 else if (e.detail.current == 3) {
  console.log(33333)
 } 
 else if (e.detail.current == 4) {
  console.log(44444444)
 } 
 else if (e.detail.current == 5) {
  console.log(55555)
 } 
 }
})

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

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

相關(guān)文章

  • JS中promise化微信小程序api

    JS中promise化微信小程序api

    這篇文章主要給大家通過代碼實例分析了promise化微信小程序api的使用方法,對此有需要的朋友可以參考學(xué)習下。
    2018-04-04
  • js 毫秒轉(zhuǎn)天時分秒的實例

    js 毫秒轉(zhuǎn)天時分秒的實例

    下面小編就為大家分享一篇js 毫秒轉(zhuǎn)天時分秒的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2017-11-11
  • IE8提示Invalid procedure call or argument 異常的解決方法

    IE8提示Invalid procedure call or argument 異常的解決方法

    某臺機器上,訪問公司的好幾個產(chǎn)品網(wǎng)站,都拋出很多 Invalid procedure call or argument ,跟進了下,情況最后簡化為
    2012-09-09
  • 小程序如何寫動態(tài)標簽的實現(xiàn)方法

    小程序如何寫動態(tài)標簽的實現(xiàn)方法

    這篇文章主要介紹了小程序如何寫動態(tài)標簽的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友們下面隨著小編來一起學(xué)習學(xué)習吧
    2020-02-02
  • 小程序?qū)崿F(xiàn)側(cè)邊欄切換

    小程序?qū)崿F(xiàn)側(cè)邊欄切換

    這篇文章主要為大家詳細介紹了小程序?qū)崿F(xiàn)側(cè)邊欄切換效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • js?實現(xiàn)div拖拽拉伸完整示例

    js?實現(xiàn)div拖拽拉伸完整示例

    這篇文章主要為大家介紹了js?實現(xiàn)div拖拽拉伸完整示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-10-10
  • TypeScript的安裝、使用、自動編譯的實現(xiàn)

    TypeScript的安裝、使用、自動編譯的實現(xiàn)

    TypeScript是一種由微軟開發(fā)的開源、跨平臺的編程語言。這篇文章主要介紹了TypeScript的安裝、使用、自動編譯的實現(xiàn)方法,需要的朋友可以參考下
    2020-04-04
  • 自己動手寫的javascript前端等待控件

    自己動手寫的javascript前端等待控件

    等待控件在網(wǎng)上搜有好多種,但是都很復(fù)雜,不一定用的順手,再說我的項目是bootstrap的原因,又不敢輕易使用第三方控件,怕不兼容,于是自己動手寫了個等待控件,有需要的朋友可以參考下
    2015-10-10
  • JavaScript獲得當前網(wǎng)頁來源頁面(即上一頁)的方法

    JavaScript獲得當前網(wǎng)頁來源頁面(即上一頁)的方法

    這篇文章主要介紹了JavaScript獲得當前網(wǎng)頁來源頁面(即上一頁)的方法,涉及javascript中document.referrer方法的使用技巧,需要的朋友可以參考下
    2015-04-04
  • 微信小程序?qū)崿F(xiàn)單選功能

    微信小程序?qū)崿F(xiàn)單選功能

    這篇文章主要為大家詳細介紹了微信小程序?qū)崿F(xiàn)單選功能,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-10-10

最新評論