toastUtil.js 347 B

123456789101112131415161718192021
  1. module.exports = {
  2. show,
  3. }
  4. function show(title, icon = "none", duration) {
  5. wx.hideLoading();
  6. setTimeout(() => {
  7. if (duration == null) {
  8. wx.showToast({
  9. icon: icon,
  10. title: title,
  11. });
  12. } else {
  13. wx.showToast({
  14. icon: icon,
  15. title: title,
  16. duration: 1000,
  17. });
  18. }
  19. }, 300)
  20. }