小程序开发-微信小程序的各种弹窗

小程序开发-微信小程序的各种弹窗

演示图片

图片[1]-小程序开发-微信小程序的各种弹窗-乡野博文

小程序的弹窗效果不仅只有七种形式,以下只是简单列举下。

1、纯文本提示

   wx.showToast({
      title: '纯文字弹窗',
      icon: 'none',    //如果要纯文本,不要icon,将值设为'none'
      duration: 2000     
    })  

2、取消确认提示

 wx.showModal({
      title: 'confirm的弹窗',
      content: '确认要删除该项吗?',
      success: function (res) {
        if (res.confirm) {  
          console.log('点击确认回调')
        } else {   
          console.log('点击取消回调')
        }
      }
    })

3、成功提示

wx.showToast({
      title: '成功提示弹窗',
      icon: '',     //默认值是success,就算没有icon这个值,就算有其他值最终也显示success
      duration: 2000,      //停留时间
    })

4、自定义图标弹窗

 wx.showToast({
      title: '自定义图标弹窗',
      image: '../../static/image/icon.png',  //image的优先级会高于icon
      duration: 2000     
    })

5、加载中提示

wx.showLoading({      title:'加载中...'    });

6、带蒙层的弹窗

wx.showToast({
      title: '带蒙层的弹窗',     
      duration: 2000,    
      mask:true    //是否有透明蒙层,默认为false 
                   //如果有透明蒙层,弹窗的期间不能点击文档内容 
    })

7、有列表弹窗

wx.showActionSheet({
      itemList: ['A', 'B', 'C'],
      success: function (res) {
        console.log(res);
      }
    })
温馨提示:本文最后更新于2022-07-08 07:50:31,某些文章具有时效性,若有错误或已失效,请在下方留言或联系乡野博文
您阅读这篇文章共花了: 0小时00分00秒
-----本页内容已结束,喜欢请分享!-----
© 版权声明
THE END
喜欢本站内容,请点【点赞】【分享】和【收藏】~
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容