问题: vux scroller在iOS13上,一停止滑动就跳到顶部
找了下解决办法,最后找到原文这个链接,亲测有效:
https://blog.csdn.net/sllailc...
在 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 )的就可以了。**
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;
},
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。