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;
  },
相關文章
相關標籤/搜索