1. wx.showToast(Object object) 显示消息提示框
wx.showToast 应与 wx.hideToast 配对使用 wx.showLoading 和 wx.showToast 同时只能显示一个
wx.showToast({ title: '成功', icon: 'success',//当icon:'none'时,没有图标 只有文字 duration: 2000 }) /* title {string} 提示的内容,长度与 icon 取值有关。 icon {string} 图标 image {string} 自定义图标的本地路径 mask {boolean} 遮罩层 duration {number} 持续时间 默认1500 position {string} 显示位置 'top','center','bottom' success {function} 成功的回调 fail {function} 失败的回调 complete {function} 结束的回调 */ uni.hideToast(); //隐藏提示框例: 2. wx.showModal(Object object) 显示模态对话框
wx.showModal({ title: '提示', content: '这是一个模态弹窗', success(res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) /* title {string} 提示的标题 content {string} 提示的内容 showCancel {boolean} 是否显示关闭按钮 true cancelText {string} 取消按钮的文字,"取消",最多四个字符 cancelColor {HexColor} 取消按钮的文字颜色 confirmText {string} 确认按钮的文字,"取消",最多四个字符 confirmColor {HexColor} 确认按钮的文字颜色 success {function} 成功的回调 fail {function} 失败的回调 complete {function} 结束的回例: 3. wx.showLoading(Object object) 显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({ title: '加载中', }) wx.hideLoading();例:
4. wx.showActionSheet(Object object)
wx.showActionSheet({ itemList: ['A', 'B', 'C'], success(res) { console.log(res.tapIndex) }, fail(res) { console.log(res.errMsg) } })例: