在iphone XS上,系统13.6.1,微信版本8.0.22,WXS不执行是为什么
-------wxml--------
<scroll-view class="scroll-wrap" scroll-y scrollTop="{{scrollTop}}" bindscroll="{{tools.onScroll}}" data-list="{{anchorList}}" scroll-into-view="{{toView}}" enhanced show-scrollbar="{{false}}">
<view class="punch-list-item" id="item{{index}}" wx:for="{{contentList}}" wx:key="this">
<view class="anchor">{{item.fullName}}</view>
<view class="anchor-content">
<view class="anchor-content-item" wx:for="{{item.oneAreaBaseList}}" wx:key="this" style="width: {{photoWidth}}">
<image wx:if="{{item.isPunch == 1}}" mode="scaleToFill" class="punch-img base{{item.baseId}}" src="{{item.albumImageUrl || '1'}}" bindtap="clickImg" data-currentimg="{{item}}" bindload="imgLoaded" binderror="imgLoaded" style="height: {{windowWidth/375*115}}px;"></image>
<view wx:else class="item-punch">
<image class="item-punch-bg" mode="scaleToFill" src="../images/bg-item-punch.png" style="height: {{windowWidth/375*115}}px;"></image>
<view class="item-punch-content">
<image class="punch-icon" src="../images/punch-icon.png"></image>
<view class="punch-text">您还未打卡~</view>
<view class="punch-btn" bindtap="goBaseDetail" data-baseid="{{item.baseId}}">去打卡</view>
</view>
</view>
<view class="base-name">{{item.baseName}}</view>
</view>
</view>
</view>
</scroll-view>
-----wxs-----
/** 列表滚动 */
function onScroll(e,ins) {
console.log('滚动页面');
var scrollTop = e.detail.scrollTop,
anchorList = e.currentTarget.dataset.list
anchorList.forEach(function(item,index) {
if(scrollTop >= item.top-45) {
if(index+1 == anchorList.length) {
ins.callMethod('listScroll',{currentIndex: index})
}else if(scrollTop < anchorList[index+1].top-45){
ins.callMethod('listScroll',{currentIndex: index})
}
}
})
}
代码片段提供下