index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { $wuxActionSheet } from '../../dist/index'
  2. import ad from '../index/ad'
  3. ad({
  4. data: {},
  5. onLoad() {},
  6. showActionSheet1() {
  7. wx.showActionSheet({
  8. itemList: ['实例菜单', '实例菜单'],
  9. })
  10. },
  11. showActionSheet2() {
  12. $wuxActionSheet().showSheet({
  13. titleText: '自定义操作',
  14. buttons: [{
  15. text: 'Go Dialog',
  16. },
  17. {
  18. text: 'Go Toast',
  19. }],
  20. buttonClicked(index, item) {
  21. index === 0 && wx.navigateTo({
  22. url: '/pages/dialog/index',
  23. })
  24. index === 1 && wx.navigateTo({
  25. url: '/pages/toast/index',
  26. })
  27. return true
  28. },
  29. cancelText: '取消',
  30. cancel() {},
  31. destructiveText: '删除',
  32. destructiveButtonClicked() {},
  33. })
  34. },
  35. showActionSheet3() {
  36. if (this.timeout) clearTimeout(this.timeout)
  37. const hideSheet = $wuxActionSheet().showSheet({
  38. theme: 'wx',
  39. titleText: '三秒后自动关闭',
  40. buttons: [{
  41. text: '实例菜单',
  42. },
  43. {
  44. text: '实例菜单',
  45. }],
  46. buttonClicked(index, item) {
  47. return true
  48. },
  49. })
  50. this.timeout = setTimeout(hideSheet, 3000)
  51. },
  52. })