该功能实现依赖于 微信小程序 模板容器 swiper,及其提供的属性方法;具体实现如下:
上代码
index.wxml
<!--pages/index/index.wxml-->
<view class="page">
<!-- <view class="layout-header"></view> -->
<view class="layout-content">
<view class="layout-tab">
<view class="layout-tab-title">
<view class="tab-title {
{isSelect == '0'? 'select': ''}}" bindtap="changeTab" data-type="0">
<view>精选</view>
</view>
<view class="tab-title {
{isSelect == '1'? 'select': ''}}" bindtap="changeTab" data-type="1">
<view>订阅</view>
</view>
</view>
<view class="layout-tab-swiper">
<swiper current="{
{isSelect}}" bindchange="swiperChange" duration="{
{200}}">
<block>
<swiper-item>
<view class="layout-tab-lists">
<view class="layout-image-swiper">