vux scroller在iOS13上,一中止滑动就跳到顶部

问题: vux scroller在iOS13上,一中止滑动就跳到顶部

找了下解决办法,最后找到原文这个连接,亲测有效:
https://blog.csdn.net/sllailc...node


在 node_modules_vux-xscroll@3.1.12@vux-xscrollbuildcmdsimulate-scroll.js下的getScrollTop方法以下
这里路径可能不彻底同样,反正就是源码库里的vux-xscroll里的simulate-scroll.js文件正则表达式

getScrollTop: function() {
    var transY = window.getComputedStyle(this.container)[transform].match(/[-\d\.*\d*]+/g);
    return transY ? Math.round(transY[5]) === 0 ? 0 : -Math.round(transY[5]) : 0;
},

解决办法:

将\node_modules\_vux-xscroll@3.1.12@vux-xscroll\build\cmd\simulate-scroll.js下的getScrollTop方法里面的正则表达式替换成下面(/[-\d\.*\d*e\-\d]+/g )的就能够了。**ui

getScrollTop: function() {
    // var transY = window.getComputedStyle(this.container)[transform].match(/[-\d\.*\d*]+/g);
    var transY = window.getComputedStyle(this.container)[transform].match(/[-\d\.*\d*e\-\d]+/g);
    return transY ? Math.round(transY[5]) === 0 ? 0 : -Math.round(transY[5]) : 0;
  },
相关文章
相关标签/搜索