小程序模态对话框
- 显示确定按钮和取消按钮
wx.showModal({
title: '提示',
content: "确认拨打111116吗",//提示内容
confirmColor: '#2EA7E0',//确定按钮的颜色
success (res) {
if (res.confirm) {
console.log('用户点击确定按钮')
} else if (res.cancel) {
console.log('用户点击取消按钮')
}
}
})
2.不显示取消按钮
wx.showModal({
title: '提示',
content: "确认拨打111116吗",//提示内容
confirmColor: '#2EA7E0',//确定按钮的颜色
showCancel: false,//不显示取消按钮
success (res) {
if (res.confirm) {
console.log('用户点击确定按钮')
} else if (res.cancel) {
console.log('用户点击取消按钮')
}
}
})
showCancel: false
不显示取消按钮
confirmColor: '#2EA7E0',
确定按钮的颜色