g***@163.com
g***@163.com
  • 发布:2018-03-09 13:37
  • 更新:2019-03-21 12:14
  • 阅读:2167

使用requirejs时,解决pullRefresh下拉报错的问题

分类:MUI

使用requirejs后,下拉可能会报错如下:
Uncaught (in promise) TypeError: mui(...).pullRefresh(...).endPulldownToRefresh is not a function

解决方案:
修改mui.js v3.7.2 5467行

//override h5 pullRefresh  
        $.fn.pullRefresh_native = function(options) {  
            var self;  
            if (this.length === 0) {  
                self = document.createElement('div');  
                self.className = 'mui-content';  
                document.body.appendChild(self);  
            } else {  
                self = this[0];  
                //解决方案:使用requirejs时,这里的this可能有缓存,需要重新获取  
                if (typeof define === 'function' && define.amd) {  
                    self = document.getElementById(self.getAttribute("id"));  
                }  
            }  
            。。。

改完后不报错了,请官方确认此问题并及时修改

0 关注 分享

要回复文章请先登录注册

2***@qq.com

2***@qq.com

mui的原生下拉有这个问题,我按你的思路改了 还是偶尔有错误,,只能不用原生的那个动画了
2019-03-21 12:14
2***@qq.com

2***@qq.com

Uncaught TypeError: $container.pullRefresh is not a function
我这边下拉刷新是这个错误,10次有1-2次会出现
2019-03-17 23:58