下面是封装好的封装微信小程序提示框,以便在开发过程中能快速使用,并且可以减少代码量。
var showBusy = function(o) {
return wx.showToast({
title: o,
icon: "loading",
duration: 2e3
})
},
showSuccess = function(o,s) {
return wx.showToast({
title: o,
icon: "success",
duration: 2e3,
success: function () {
"function" == typeof s && s()
}
})
},
showModel = function(o, n, s) {
wx.hideToast(), wx.showModal({
title: o,
content: n,
showCancel: !1,
success: function(o) {
o.confirm && "function" == typeof s && s()
}
})
},
showLoading = function(o) {
return wx.showLoading({
title: o,
icon: "loading",
mask: !0,
duration: 1e4
})
},
hideLoading = function() {
wx.hideLoading()
},
showWarning = function(o, n) {
wx.hideToast(), wx.showModal({
title: o,
content: n,
showCancel: !1
})
},
showConfirm = function(o, n, s) {
wx.hideToast(), wx.showModal({
title: o,
content: n,
success: function(o) {
o.confirm && "function" == typeof s && s()
}
})
};
module.exports = {
showBusy: showBusy, //加载框
showSuccess: showSuccess, //成功
showModel: showModel,
showLoading: showLoading,
hideLoading: hideLoading,
showWarning: showWarning,
showConfirm: showConfirm
};