赞
踩
(1)把"backgroundTextStyle":“light"改为"backgroundTextStyle”:“dark”
(2)添加"enablePullDownRefresh":true,开启下拉刷新。
1.在app.js中增加两个生命周期函数
- onPullDownRefresh:function(){
- this.onRefresh();
- },
- onRefresh:function(){
- //导航条加载动画
- wx.showNavigationBarLoading();
- setTimeout(function () {
- wx.hideNavigationBarLoading();
- //停止下拉刷新
- wx.stopPullDownRefresh();
- }, 2000);
- },
1、首先在页面的json文件中添加设置:
“enablePullDownRefresh”: true
- {
- "usingComponents": {},
- "enablePullDownRefresh": true
- }
2、在js文件中写一个onRefresh()生命周期:
- onRefresh:function(){
- //导航条加载动画
- wx.showNavigationBarLoading()
- //loading 提示框
- wx.showLoading({
- title: 'Loading...',
- })
- console.log("下拉刷新啦");
- setTimeout(function () {
- wx.hideLoading();
- wx.hideNavigationBarLoading();
- //停止下拉刷新
- wx.stopPullDownRefresh();
- }, 2000)
- },
3、在onPullDownRefresh()中调用上面写的函数:
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh:function(){
- this.onRefresh();
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。