小程序movable-view拖动排序
文章目录
关于movable其实很简单,但是结合createIntersectionObserver好像有些诡异的地方,故此记录。
效果(gif有失真):

代码片段 https://developers.weixin.qq....
实现流程
chooseImage(){
//1.选图,并且格式化一下数据 return Promise
}
generate(lists){
//2.遍历lists,根据样式设计给每项加上x,y属性生成renderLists,然后setData渲染,movable animation默认为true,disable默认为true,不可拖动
}
handleLongPress(){
//3.为了不和scrollview的横向事件冲突,只有长按时,当前item可拖动(disable为false)
//记录当前item的id,开启createIntersectionObserver监听与其他item的相交
}
refreshLists(){
//4.当intersectionRatio在设定范围之内时,重新设置renderLists setData。断开监听
}
问题:只有当handleTouchEnd触发时,createIntersectionObserver才能监听到相交变动

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论