微信小程序api视频课程-界面-交互-wx.showModal 模态对话框的使用

效果图

微信小程序api视频课程-界面-交互-wx.showModal 模态对话框的使用

wxml代码

wx.showModal(Object object)
显示模态对话框

<button bindtap="mt01">模态对话框01</button>

<button bindtap="mt02">模态对话框02</button>

js代码

 /**
   * 页面的初始数据
   */
  data: {

  },
  mt01:function(){
    wx.showModal({
      title: '提示标题',
      content: '模态框的内容',
    })
  },
  mt02:function(){
    wx.showModal({
      title: '提示标题',
      content: '模态框的内容',
      success(res){
        if(res.confirm)
        {
          console.log("用户点击了确定")

        }else if(res.cancel)
        {
          console.log("用户点击了取消")  
          
        }
      }
    })
  },

欢迎大家收看我的****:微信小程序常用API使用

微信小程序api视频课程-界面-交互-wx.showModal 模态对话框的使用