微信小程序wx.showModal(不显示“取消”按钮,修改“确定”按钮名称)

API原型

wx.showModal({
  title: '标题',
  content: '内容',
  success: function (res) {
    if (res.confirm) {
      //点击确定按钮
    } else if (res.cancel) {
      //点击取消按钮
    }
  }
})

在这里插入图片描述
修改后
关键代码

confirmText: "知道了",
  showCancel: false,
wx.showModal({
  title: '您没有授权,无法保存到相册',
  confirmText: "知道了",
  showCancel: false,
  success: function (res) {
    if (res.confirm) {
      //点击确定按钮
    } else if (res.cancel) {
      //点击取消按钮
    }
  }
})

在这里插入图片描述


版权声明:本文为zuo_zuo_blog原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。