小程序
小游戏
企业微信
微信支付
扫描小程序码分享
如题.
目标是做一个可操作的列表, 每一条滑动后都有些标记或者删除类的操作, 但是在touchend的时候去判断滑动到什么位置然后应该显示操作区域还是还原到主内容位置的时候会闪动, 就是在touchend里操作scroll-left, 然后应该是一边惯性控制位置, 一边是我控制位置.
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
解决了吗楼主
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
同类问题,touchend 时希望能停止惯性滚动自行定位,请问楼主解决了吗?
看看能不能试一下touchend用setTimeOut几百毫秒再操作scroll-left,大概模拟一下惯性滚动的时间再操作
touchend
ios有个是惯性滚动停止后才触发的bug
<!--index.wxml-->
<view class="container">
<view class="article-list" wx:for="{{list}}" wx:key="index">
<view class="article">
<scroll-view data-id="{{item.id}}" id="article-box-{{item.id}}" class="article-box" bind:touchstart="articleTouch" bind:touchend="articleTouchEnd" bind:touchcancel="articleTouchEnd" bind:scroll="articleScroll" scroll-with-animation="{{animation}}" scroll-into-view="article-{{item.view}}-{{item.id}}" scroll-x="true">
<view class="action-left" id="article-left-{{item.id}}">
action left
</view>
<view class="article-content" id="article-content-{{item.id}}">
{{item.text}}
<view class="action-right" id="article-right-{{item.id}}">
action right
</scroll-view>
/**index.wxss**/
.article-box {
white-space: nowrap;
height: 300rpx;
margin-top: 10rpx;
}
.action-left,
.action-right,
.article-content {
display: inline-block;
height: 100%;
width: 100%;
background-color: #fec;
.action-right {
width: 50%;
}, 100);
},
onLoad() {
listening=false;
list=[
{
id: 1,
text: 'abc',
view: 'content'
id: 2,
text: 'def',
];
setTimeout(()=>{
listening=true;
},300);
this.setData({
list: list
});
})
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
解决了吗楼主
同类问题,touchend 时希望能停止惯性滚动自行定位,请问楼主解决了吗?
看看能不能试一下touchend用setTimeOut几百毫秒再操作scroll-left,大概模拟一下惯性滚动的时间再操作
touchend
ios有个是惯性滚动停止后才触发的bug
<!--index.wxml-->
<view class="container">
<view class="article-list" wx:for="{{list}}" wx:key="index">
<view class="article">
<scroll-view data-id="{{item.id}}" id="article-box-{{item.id}}" class="article-box" bind:touchstart="articleTouch" bind:touchend="articleTouchEnd" bind:touchcancel="articleTouchEnd" bind:scroll="articleScroll" scroll-with-animation="{{animation}}" scroll-into-view="article-{{item.view}}-{{item.id}}" scroll-x="true">
<view class="action-left" id="article-left-{{item.id}}">
action left
</view>
<view class="article-content" id="article-content-{{item.id}}">
{{item.text}}
</view>
<view class="action-right" id="article-right-{{item.id}}">
action right
</view>
</scroll-view>
</view>
</view>
</view>
</view>
/**index.wxss**/
.article-box {
white-space: nowrap;
height: 300rpx;
margin-top: 10rpx;
}
.action-left,
.action-right,
.article-content {
display: inline-block;
height: 100%;
}
.article-content {
width: 100%;
background-color: #fec;
}
.action-left,
.action-right {
width: 50%;
}
}, 100);
}
},
onLoad() {
listening=false;
list=[
{
id: 1,
text: 'abc',
view: 'content'
},
{
id: 2,
text: 'def',
view: 'content'
}
];
setTimeout(()=>{
listening=true;
},300);
this.setData({
list: list
});
}
})