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

版权声明:黄菊华 https://blog.csdn.net/u013818205/article/details/88656111

效果图

在这里插入图片描述

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使用
https://edu.csdn.net/course/detail/16194
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u013818205/article/details/88656111
今日推荐