如何根据下标切换swiper-item,标题是根据下标进行切换的,但在swiper显示不了效果?
[代码]view wx:for="{{datalist}}" wx:key="" wx:for-item="item" style="">[代码][代码] [代码][代码]<[代码][代码]scroll-view[代码] [代码]scroll-x scroll-with-animation [代码][代码]scroll-left[代码][代码]=[代码][代码]"{{left}}"[代码] [代码]style[代码][代码]=[代码][代码]"padding-left: 26vw;overflow-x: auto;height: 90rpx;white-space: nowrap; font-size: 9pt;"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:for[代码][代码]=[代码][代码]"{{datalist}}"[代码] [代码]wx:key[代码][代码]=[代码][代码]""[代码] [代码]wx:for-item[代码][代码]=[代码][代码]"item"[代码] [代码]style[代码][代码]=[代码][代码]"display: inline-block;width:17vw;height:10vw;line-height:10vw;font-size:26rpx;text-align:center;text-align:center;"[代码] [代码]class[代码][代码]=[代码][代码]"{{idIndex==index?'bottomBorder':''}}"[代码] [代码]bindtap[代码][代码]=[代码][代码]"itemList"[代码] [代码]data-index[代码][代码]=[代码][代码]"{{index}}"[代码][代码]>{{item}}</[代码][代码]view[代码][代码]>[代码] [代码] [代码][代码]</[代码][代码]scroll-view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]swiper[代码] [代码]current[代码][代码]=[代码][代码]"{{currentTab}}"[代码] [代码]duration[代码][代码]=[代码][代码]"300"[代码] [代码]bindchange[代码][代码]=[代码][代码]"swiperTab"[代码] [代码]style[代码][代码]=[代码][代码]"height: 93vh;"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]swiper-item[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{idIndex==index}}"[代码] [代码]bindtap[代码][代码]=[代码][代码]"conIndex"[代码] [代码]data-index[代码][代码]=[代码][代码]"{{index}}"[代码][代码]>[代码][代码] [代码][代码]111111[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]swiper-item[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]swiper[代码][代码]>[代码][代码]itemList(e) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]var[代码] [代码]index = e.currentTarget.dataset.index;[代码][代码] [代码][代码]var[代码] [代码]oLeft = e.currentTarget.offsetLeft;[代码][代码] [代码][代码]if[代码] [代码](oLeft == 327) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]left: 327,[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]if[代码] [代码](oLeft == 0) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]left: 0,[代码][代码] [代码][代码]})[代码][代码] [代码][代码]};[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]index: index,[代码][代码] [代码][代码]idIndex: index[代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log(index + [代码][代码]" "[代码] [代码]+ that.data.idIndex);[代码][代码] [代码][代码]// if (that.data.currentTab == that.data.idIndex) {[代码][代码] [代码][代码]// return false;[代码][代码] [代码][代码]// } else {[代码][代码] [代码][代码]// that.setData({[代码][代码] [代码][代码]// idIndex: index,[代码][代码] [代码][代码]// currentTab: index[代码][代码] [代码][代码]// })[代码] [代码] [代码][代码]// }[代码][代码]},[代码][代码]conIndex: [代码][代码]function[代码][代码](e) {[代码][代码] [代码][代码]var[代码] [代码]index = e.currentTarget.dataset.index;[代码][代码] [代码][代码]console.log(index);[代码][代码]},[代码][图片][图片]