toast.js 672 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '消息提示框',
  5. path: 'packageAPI/pages/page/toast/toast'
  6. }
  7. },
  8. toast1Tap() {
  9. wx.showToast({
  10. title: '默认'
  11. })
  12. },
  13. toast2Tap() {
  14. wx.showToast({
  15. title: 'duration 3000',
  16. duration: 3000
  17. })
  18. },
  19. toast3Tap() {
  20. wx.showToast({
  21. title: 'loading',
  22. icon: 'loading',
  23. duration: 5000
  24. })
  25. },
  26. hideToast() {
  27. wx.hideToast()
  28. },
  29. onLoad() {
  30. this.setData({
  31. theme: wx.getSystemInfoSync().theme || 'light'
  32. })
  33. if (wx.onThemeChange) {
  34. wx.onThemeChange(({theme}) => {
  35. this.setData({theme})
  36. })
  37. }
  38. }
  39. })