-
wx.showToast(Object object)
显示消息提示框- wx.showLoading 和 wx.showToast 同时只能显示一个
- wx.showToast 应与 wx.hideToast 配对使用
wx.showToast({
title: '成功',
icon: 'success',
duration: 2000
})
wx.hideToast(Object object)
隐藏消息提示框。
此处object仅有属性:success、fail和complete这三个回调函数。wx.showLoading(Object object)
显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框。
wx.showLoading({
title: '加载中',
})
setTimeout(function () {
wx.hideLoading()
}, 2000)
wx.hideLoading(Object object)
隐藏 loading 提示框。wx.showModal(Object object)
显示模态对话框。
wx.showModal({
title: '提示',
content: '这是一个模态弹窗',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
wx.showActionSheet({
itemList: ['A', 'B', 'C'],
success (res) {
console.log(res.tapIndex)
},
fail (res) {
console.log(res.errMsg)
}
})