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

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

浏览量:564 时间: 来源:小溪彼岸

1、组件形式

loading hidden="{{hidden}}"    加载中.../loading

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()  }})

版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎