微信小程序开发-交互反馈

官网文档链接:交互反馈

共用的wxml:

<button type="primary" bindtap="showToastView">showToast</button>
<button type="primary" bindtap="showLoadingView">showLoading</button>
<button type="primary" bindtap="hideToastView">hideToast</button>
<button type="primary" bindtap="hideLoadingView">hideLoading</button>
<button type="primary" bindtap="showModalView">showModal</button>
<button type="primary" bindtap="showActionSheetView">showActionSheet</button>

wx.showToast(OBJECT)

显示消息提示框

showToastView:function(){
    wx.showToast({
      title: 'showToast',
      icon: "success",             //图标,有效值 "success", "loading"
      image: "/images/index.png",  //自定义图标的本地路径,image 的优先级高于 icon,存在版本兼容性
      duration: 1500,              //提示的延迟时间,单位毫秒,默认:1500
      mask: true,                  //是否显示透明蒙层,防止触摸穿透,默认:false
      success: function(){
        console.log("success showToast!");
      }
    })
  }

需要注意的就是image可以替代icon的,经测试image目前只支持本地路径

wx.showLoading(OBJECT)

基础库 1.1.0 开始支持,低版本需做兼容处理

显示 loading 提示框, 需主动调用wx.hideLoading才能关闭提示框

showLoadingView:  function(){
    wx.showLoading({
      title: 'showLoading',
      mask:true,
      success:function(e){
        console.log("success showLoading!");
      }
    })
  }


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值