使用官方刷新组件,苹果无法反弹stopPullDownRefresh
发布于 6 年前 作者 taoyu 12454 次浏览 来自 问答

苹果手机下拉刷新后,出现了顶部回弹问题,安卓不会,如何解决???

self.dataLayer(function (isData) {
      console.log("返回的数据 isData=>", isData);
      wx.hideNavigationBarLoading() //完成停止加载
      wx.stopPullDownRefresh() //停止下拉刷新
 
      if (isData) {
        ++(self.data.page);
        self.setData({
          page: page
        });
      }
    });
5 回复

试下 加个apply

可能是刷新时触发wx.showToast的原因,下拉时自带loading 动画的功能的,测试行

是指下拉刷新后,调用stopPullDownRefresh没有生效?

麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题

我也碰到同样的问题,下拉后不弹回,我觉得用

setTimeout不是解决问题的办法,而且我试了也不行,既然我已经把 wx.stopPullDownRefresh放入

success: function (res) {

//停止PullDown

}中间 ;

就表示调用成功后才stopPullDownRefresh,

在Jquery中我在成功执行请求后应该没有问题,为什么还要延时执行。

jquery在获取data后执行,完全是没问题。

$.post("InsertDefcode",$("form#DefForm").serialize(), function(data) { 
       
                     if(data=="ok"){
         
                toastr.success("缺陷添加成功!","Hi")
         
                             
                     }else if(data=="ex"){
                        location.href = "login.html";
                      
                     }else{
                        toastr.warning("缺陷/方案添加失败!","Hi")
                     
        Showlist();                 
             
            },"text").error(function() {toastr.warning("添加失败!","Hi") });   

下面小程序代码

onPullDownRefresh: function () {
   wx.showNavigationBarLoading()
   wx.showLoading({
     title: '加载中',
   })
   var that = this
   var that1 = this
   wx.request({
     url: 'https://xxxxxxxxxxxxxx', //仅为示例,并非真实的接口地址
     data: {
       loc: 'room2'
     },
     header: {
       'content-type': 'application/json' // 默认值
     },
     success: function (res) {
     
       console.log(res.data[0].update)
       wx.hideLoading();
       that.setData({
         msg: res.data[0].update
       });
       that.ecComponent = that.selectComponent('#mychart-dom-bar');
       that.ecComponent.init((canvas, width, height) => {
         // 获取组件的 canvas、width、height 后的回调函数
         // 在这里初始化图表
         const chart = echarts.init(canvas, null, {
           width: width,
           height: height
         });
         setOption(chart, res.data[0].tem, '温度', '°C');
 
         // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
         that.chart = chart;
 
         // 注意这里一定要返回 chart 实例,否则会影响事件处理等
         return chart;
       });
 
       // 获取组件
       that1.ecComponent = that1.selectComponent('#mychart-dom-bar1');
       that1.ecComponent.init((canvas, width, height) => {
         // 获取组件的 canvas、width、height 后的回调函数
         // 在这里初始化图表
         const chart1 = echarts.init(canvas, null, {
           width: width,
           height: height
         });
         setOption(chart1, res.data[0].hum, '湿度', '%');
 
         // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
         that1.chart1 = chart1;
 
         // 注意这里一定要返回 chart 实例,否则会影响事件处理等
         return chart1;
 
       });
     //  setTimeout(()=>{
      //   wx.stopPullDownRefresh;
       //  wx.hideNavigationBarLoading()
 
    //   },500)
        wx.stopPullDownRefresh;
       wx.hideNavigationBarLoading()
 
     }
   })
 
 
   console.log("n11111111111111g");
 
 
 }

无法回弹,我的手机是OPPO  R11+   ,但是可以在点一下页面后马上回弹。

同样遇到了  哪里有问题呢

回到顶部