<view class="tab-wrapper" bindtap="setActive"> <view class="tab-item {{isActive == 0 ? 'tab-item-active' : ''}}" data-index="0">关注</view> <view class="tab-item {{isActive == 1 ? 'tab-item-active' : ''}}" data-index="1">推荐</view> <view class="tab-item {{isActive == 2 ? 'tab-item-active' : ''}}" data-index="2">热榜</view> <view class="tab-item-line" animation="{{animationData}}"></view></view><view class="tab-content {{isActive == 0 ? 'show' : 'hide'}}"> // ...</view><view class="tab-content {{isActive == 1 ? 'show' : 'hide'}}"> // ...</view><view class="tab-content {{isActive == 2 ? 'show' : 'hide'}}"> // ...</view>复制代码
每个可点击的tab分别绑定data-index,在最外层bindtap绑定的方法中获取所点击的tab的index值,再根据index的值分别显示对应的tab-content
上拉加载:emmmmmm......我指的上拉加载是触底后的加载更多,怕跟大家理解的不一样o(╯□╰)o。
下拉刷新:
要注意的是,每次对数组进行操作后,都要使用setData对原数组重新赋值,否则数据不会更新的啊( ⊙ o ⊙ )!
wx.setStorage、wx.getStorage和wx.removeStorage
欢迎光临 云裂变营销网 (https://www.yunliebian.com/yingxiao/) | Powered by Discuz! X3.4 |