微信小程序_tab选项卡1
2020-06-04 08:33
288 查看
.wxml
<view class="swiper-tab"> <view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">全部</view> <view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">提现中</view> <view class="swiper-tab-item {{currentTab==2?'active':''}}" data-current="2" bindtap="clickTab">已提现</view> </view> <swiper current="{{currentTab}}" duration="300" bindchange="swiperTab"> <swiper-item ><view>全部</view></swiper-item> <swiper-item><view>提现中</view></swiper-item> <swiper-item><view>已提现</view></swiper-item> </swiper>
.wxss
.swiper-tab{ width: 100%; border-bottom: 2rpx solid #ccc; text-align: center; height: 88rpx; line-height: 88rpx; display: flex; flex-flow: row; justify-content: space-between; } .swiper-tab-item{ width: 30%; color:#434343; } .active{ color:#F65959; border-bottom: 4rpx solid #F65959; } swiper{ text-align: center; }
.js
var app = getApp() Page({ data: { currentTab: 0 }, onLoad: function (options) { // 页面初始化 options为页面跳转所带来的参数 }, //滑动切换 swiperTab: function (e) { var that = this; that.setData({ currentTab: e.detail.current }); }, //点击切换 clickTab: function (e) { var that = this; if (this.data.currentTab === e.target.dataset.current) { return false; } else { that.setData({ currentTab: e.target.dataset.current }) } } })
相关文章推荐
- 微信小程序-tab选项卡
- mpvue微信小程序tab选项卡切换功能源码
- 微信小程序官方自带tab选项卡
- 微信小程序tab选项卡切换
- 微信小程序顶部用 scroll-view 组件横向滚动,类似tab选项卡的效果,
- 转载【微信小程序】:微信小程序滚动Tab选项卡:左右可滑动切换(仿某宝)
- 微信小程序的tab选项卡的实现效果
- 微信小程序的tab选项卡的实现 --小丑
- 微信小程序:使用swiper与scroll-view实现tab选项卡(2)
- 微信小程序tab选项卡
- 微信小程序滚动Tab选项卡:左右可滑动切换
- 微信小程序的tab选项卡的实现
- 记录:微信小程序选项卡tab切换swiper根据客户端高度自适应
- 微信小程序 swiper scroll-view height设置自适应 tab选项卡
- 微信小程序滚动Tab选项卡:左右可滑动切换
- 微信小程序滚动Tab选项卡:左右可滑动切换
- 微信小程序自定义tabbar custom-tab-bar 6s出不来解决方案(cover-view不兼容)
- 微信小程序开发之选项卡(窗口底部TabBar)页面切换
- 微信小程序笔记--tab切换 (有点像滴滴的导航)
- 微信小程序redirect 到tab不刷新