提示框
wx.showToast
:微信小程序官方文档
关键属性
代码实现
<button bindtap="butt" >保存</button>
butt(){
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 1500,
success: function () {
//弹窗后执行,可以省略
setTimeout(function () {
wx.reLaunch({
url: '../index/index',
})
}, 1500);
}
})
}
确认框
wx.showModal
:微信小程序官方文档
代码实现
<button bindtap="delete" >删除</button>
delete(){
wx.showModal({
title: '提示',
content: '这是一个模态弹窗',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}