直播软件app开发,自定义展示弹窗的方式

直播软件app开发,自定义展示弹窗的方式

1.showToast

 


<!-- index.wxml -->
<!-- wx.showToast(消息提示框) -->
<button bindtap="handleShowToast">ShowToast</button>
// index.js
Page({
  handleShowToast() {
    wx.showToast({
      title: '内容', //提示的内容
      duration: 2000, //持续的时间
      icon: 'loading', //图标有success、error、loading、none四种
      mask: true //显示透明蒙层 防止触摸穿透
    })
  }
  })

showLoading 和 wx.showToast 同时只能显示一个

showToast 应与 wx.hideToast 配对使用

2.showModal

 


<!-- index.wxml -->
<!-- wx.showModal(模态对话框) -->
<button bindtap="handleShowModal">ShowModal</button>
// index.js
Page({
  handleShowModal() {
    wx.showModal({
      title: '我是标题', //提示的标题
      content: '我是内容', //提示的内容
      success: function(res) {
        if(res.confirm) {
          console.log('用户点击了确定')
        }
        if(res.cancel) {
          console.log('用户点击了取消')
        }
      }
    })
  }
  })

 

以上就是 直播软件app开发,自定义展示弹窗的方式,更多内容欢迎关注之后的文章

 

posted @ 2022-10-27 14:10  云豹科技-苏凌霄  阅读(101)  评论(0)    收藏  举报