方法一:全局設(shè)置下拉刷新功能
? ? ?1、在app.json的"window"中進(jìn)行配置
? ? ? ? (1)把"backgroundTextStyle":“l(fā)ight"改為"backgroundTextStyle”:“dark”
????????(2)添加"enablePullDownRefresh":true,開啟下拉刷新。
? ? ? 2、在app.js中增加兩個(gè)生命周期函數(shù)
onPullDownRefresh:function(){
this.onRefresh();
},
onRefresh:function(){
//導(dǎo)航條加載動(dòng)畫
wx.showNavigationBarLoading();
setTimeout(function () {
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}, 2000);
},
?方法一:全局設(shè)置下拉刷新功能
????????1、在需要設(shè)置下拉刷新功能頁面的 jons 文件夾中配置??"enablePullDownRefresh":true
{
"navigationBarTitleText": "查看啟動(dòng)日志",
"enablePullDownRefresh":true
}
? ? ? ? ?2、在需要設(shè)置下拉刷新功能頁面 js 文件中寫一個(gè) onRefresh() 生命周期
onRefresh:function(){
//導(dǎo)航條加載動(dòng)畫
wx.showNavigationBarLoading()
//loading 提示框
wx.showLoading({
title: '刷新中...',
})
console.log("下拉刷新啦");
setTimeout(function () {
wx.hideLoading();
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}, 2000)
},
? ? ? ?3、在需要設(shè)置下拉刷新功能頁面 js 文件中添加 onPullDownRefresh() 調(diào)用上面寫的函數(shù)文章來源:http://www.zghlxwxcb.cn/news/detail-636398.html
onPullDownRefresh:function(){
this.onRefresh();
},
? ? ? ?4、將需要刷新加載的方法放入?onRefresh() 生命周期內(nèi)即可文章來源地址http://www.zghlxwxcb.cn/news/detail-636398.html
到了這里,關(guān)于實(shí)現(xiàn)微信小程序下拉刷新功能的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!