• 微信小程序-tab切换


    //wxml

    <view class="wrap">
    <view class="swiper-tab">
    <view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">可用码</view>
    <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">已使用</view>
    </view>
     
    <swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight-36}}px" bindchange="bindChange">
    <!-- 简介 -->
    <swiper-item>
    <scroll-view class="intro_main" style="height:{{winHeight-36}}px" scroll-y="true">
    <view class="vipList">
    <view class="vipListBar" wx:for="{{11}}">
    <view class="vipListBarBox">
    <view class="vipListBarBoxLeft">VIP服务码</view>
    <view class="vipListBarBoxRight">VMI9E3L3G9</view>
    </view>
    <view class="vipListBarText">复制使用</view>
    </view>
    </view>
    </scroll-view>
    </swiper-item>
    <!-- 目录 -->
    <swiper-item>
    <scroll-view class="Catalog" style="height:{{winHeight-36}}px" scroll-y="true">
    <view class="vipList">
    <view class="vipListBar" wx:for="{{9}}">
    <view class="vipListBarBox">
    <view class="vipListBarBoxLeft leftActive">VIP服务码</view>
    <view class="vipListBarBoxRight RightActive">VMI9E3L3G9</view>
    </view>
    <view class="vipListBarText active">已失效</view>
    </view>
    </view>
    </scroll-view>
    </swiper-item>
    </swiper>
    </view>
     
    .swiper-tab{
    100%;
    border-bottom: 1rpx solid #e6e6e6;
    text-align: center;
    line-height: 68rpx;
    box-sizing: border-box;
    display: flex;
    justify-content: space-around;
    }
    .swiper-tab-list{
    font-size: 30rpx;
    100rpx;
    color: #999999;
    font-weight: bold;
     
    }
    .on{
    color: #333333;
    border-bottom: 4rpx solid #da7c0c;
    }
    .swiper-box{ display: block; 100%; overflow: hidden; margin-bottom: 100rpx;}
     
    data: {
    winWidth: 0,
    winHeight: 0,
    // tab切换
    currentTab: 0,
    },
    // 滑动切换tab
    bindChange: function (e) {
    var that = this;
    that.setData({ currentTab: e.detail.current });
    },
    /**
    * 点击tab切换
    */
    swichNav: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
    return false;
    } else {
    that.setData({
    currentTab: e.target.dataset.current
    })
    }
    },
    onLoad: function (options) {
    var that= this;
    wx.getSystemInfo({
    success: function (res) {
    that.setData({
    winWidth: res.windowWidth,
    winHeight: res.windowHeight
    });
    }
    })
    },
  • 相关阅读:
    [React Router v4] Render Catch-All Routes with the Switch Component
    [React Router v4] Render Nested Routes
    关系数据库规范化理论 函数依赖与范式理论
    Notepad++背景颜色设置
    initial pointer [expert c]
    世界微波射频领域传奇人物
    hdu 4619 Warm up 2 ( 二分图最大匹配 )
    关于数据的归档存入文件和读取文件
    android中通过自定义xml实现你需要的shape效果 xml属性配置
    Java和C#中String直接赋值与使用new创建(==与equals进行比较)的区别
  • 原文地址:https://www.cnblogs.com/weiwentaweb/p/8257411.html
Copyright © 2020-2023  润新知