微信小程序-显示loading的几种方式

1、组件形式


2、动态形式

showToast 和 showLoading

wx.showToast()wx.showLoading()
参数itle icon image duration masktitle mask
关闭方法设置duration,定时关闭;使用wx.hideToast()关闭只能用wx.hideLoading()关闭
iconsuccess loading none固定显示加载icon

wx.showToast()

// 设置加载模态框

wx.showToast({title: '加载中', icon: 'loading', duration: 10000});
wx.hideToast();

// 使用案例

wx.showToast({title: '加载中', icon: 'loading', duration: 10000});wx.request({url: ...,...,success: (res) => {},fail: () => {},complete: () => {wx.hideToast()}
})

wx.showLoading()

wx.showLoading({title: ‘加载中…’})
wx.hideLoading()

// 使用案例

wx.showLoading({title: '加载中', icon: 'loading', duration: 10000});wx.request({url: ...,...,success: (res) => {},fail: () => {},complete: () => {wx.hideLoading()}
})


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部