• 小程序-tabBar简易版


    
    
    <!-- 结构 -->
    <view class="wrapper">
    <block wx:for="{{desc}}">
    <view bindtap="toggle" data-index="{{index}}" class="{{descIndex===index?'active':''}}">{{item}}</view>
    </block>
    </view>
    <view wx:if="{{descIndex===0}}">
    商品详情
    </view>
    <view wx:if="{{descIndex===1}}">
    产品参数
    </view>
    <view wx:if="{{descIndex===2}}">
    售后保障
    </view>
    
    
    /* 样式 */
    .wrapper{
    display: flex;
    justify-content: space-around;
    }
    .wrapper view{
    flex: 1;
    text-align: center;
    line-height: 100rpx;
    border-bottom: 1rpx solid #ccc;
    }
    .wrapper .active{
    color: red;
    font-weight: bold;
    border-bottom: 1rpx solid red;
    }
    Page({
        data: {
            desc: ["商品详情", "产品参数", "售后保障"],
            descIndex: 0,
        },
        toggle(e) {
            this.setData({
                descIndex: e.currentTarget.dataset.index
            })
        },
    })

  • 相关阅读:
    ➡️➡️➡️IELTS reading by Simon on Bili
    lc0502
    lc0331
    lc0329
    lc0327
    lc0326
    lc0324
    lc0320
    lc0319
    lc0316
  • 原文地址:https://www.cnblogs.com/wuqilang/p/12075298.html
Copyright © 2020-2023  润新知