index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { $wuxNotification } from '../../dist/index'
  2. import ad from '../index/ad'
  3. ad({
  4. data: {},
  5. onLoad() {},
  6. showNotification() {
  7. this.closeNotification = $wuxNotification().show({
  8. image: 'http://cdn.skyvow.cn/logo.png',
  9. title: '宝宝',
  10. text: '嘤嘤嘤,人家拿小拳拳捶你胸口!!!',
  11. data: {
  12. message: '逗你玩的!!!',
  13. },
  14. duration: 3000,
  15. onClick(data) {
  16. console.log(data)
  17. },
  18. onClose(data) {
  19. console.log(data)
  20. },
  21. })
  22. },
  23. showNotificationReturn() {
  24. if (this.timeout) clearTimeout(this.timeout)
  25. const hide = $wuxNotification().show({
  26. image: 'http://cdn.skyvow.cn/logo.png',
  27. title: '宝宝',
  28. text: '嘤嘤嘤,人家拿小拳拳捶你胸口!!!',
  29. data: {
  30. message: '逗你玩的!!!',
  31. },
  32. duration: 3000,
  33. })
  34. this.timeout = setTimeout(hide, 1000)
  35. },
  36. showNotificationPromise() {
  37. const hide = $wuxNotification().show({
  38. image: 'http://cdn.skyvow.cn/logo.png',
  39. title: '宝宝',
  40. text: '嘤嘤嘤,人家拿小拳拳捶你胸口!!!',
  41. data: {
  42. message: '逗你玩的!!!',
  43. },
  44. duration: 3000,
  45. })
  46. // hide.promise.then(() => console.log('success'))
  47. hide.then(() => console.log('success'))
  48. },
  49. })