2021-11-12
开发中碰到IOS端下拉刷新调用wx.stopPullDownRefresh()方法会有1秒左右延迟才缩回,中间会导致一些按钮无法点击。
百度查了下,17年就有人提出这个问题,但一直没有解决。
因为只有IOS端出现这个问题,同时延迟时间在1秒左右,因此想了个临时的办法,用一个wx.showLoading将这个1秒等待的时间占用的。
代码如下
wx.stopPullDownRefresh();
let that = this;
const info = wx.getSystemInfoSync()
if (info.platform === 'android') {
that.init();//刷新数据
} else {
wx.showLoading({
title: "正在获取..",
mask: true,
});
setTimeout(function () {
wx.hideLoading();//关闭loading
that.init();//刷新数据
}, 1000);//1秒延迟
}