当前位置:   article > 正文

微信小程序的弹窗提示_微信小程序弹出提示框

微信小程序弹出提示框

 第一种:弹出提示框,用户可以选择确定或者取消,且都带有回调

  1. wx.showModal({
  2. title: '提示',
  3. content: '这是一个模态弹窗',
  4. success: function (res) {
  5. if (res.confirm) { //这里是点击了确定以后
  6. console.log('用户点击确定')
  7. } else { //这里是点击了取消以后
  8. console.log('用户点击取消')
  9. }
  10. }
  11. })

 第二种直接弹出成功的 用户无法选择确定与取消

 

  1. wx.showToast({
  2. title: '成功提示!',
  3. icon: 'success',
  4. duration: 2000 //持续的时间
  5. })

第三种:等待中...

 

  1. wx.showToast({
  2. title: '等待中...',
  3. icon: 'loading',
  4. duration: 2000//持续的时间
  5. })

第四种:无任何图标仅仅只是展示

 

  1. wx.showToast({
  2. title: '您好,加油~',
  3. icon: 'none',
  4. duration: 2000//持续的时间
  5. })

 第五种:弹窗提示选项

  1. wx.showActionSheet({
  2. itemList: ['A', 'B', 'C'],
  3. success: function (res) {
  4. if (!res.cancel) {
  5. console.log(res.tapIndex) //这里是点击了那个按钮的下标
  6. }
  7. }
  8. })

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号