1. 模态窗口 wx.showModal
1 2 3 4 5 6 7 8 9 10 11 12 13 | delete (){ wx.showModal({ title: '' , content: '是否确认删除' , success(res) { if (res.confirm) { console.log( '用户点击确定' ) } else if (res.cancel) { console.log( '用户点击取消' ) } } }) } |
2. 提示信息 showToast
1 2 3 4 5 | wx.showToast({ title: '成功' , icon: 'success' , duration: 2000 }) |
注意:
wx.showLoading 和 wx.showToast 同时只能显示一个
wx.showToast 应与 wx.hideToast 配对使用
3. 显示 loading 提示框 wx.showLoading
1 2 3 4 | wx.showLoading({ title: '加载中' ,})setTimeout( function () { wx.hideLoading( )}, 2000) |
4. wx.showActionSheet(OBJECT)
1 2 3 4 5 6 7 8 | wx.showActionSheet({ itemList: [ 'A' , 'B' , 'C' ], success: function (res) { console.log(res.tapIndex) }, fail: function (res) { console.log(res.errMsg) }}) |