shortcut.js 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const App = getApp();
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. },
  6. /**
  7. * 组件的属性列表
  8. * 用于组件自定义设置
  9. */
  10. properties: {
  11. right: {
  12. type: String,
  13. value: '24rpx'
  14. },
  15. bottom: {
  16. type: String,
  17. value: '250rpx'
  18. }
  19. },
  20. /**
  21. * 私有数据, 组件的初始数据
  22. * 可用于模版渲染
  23. */
  24. data: {
  25. // 弹窗显示控制
  26. isShow: false,
  27. transparent: true
  28. },
  29. /**
  30. * 组件的方法列表
  31. * 更新属性和数据的方法与更新页面数据的方法类似
  32. */
  33. methods: {
  34. /**
  35. * 导航菜单切换事件
  36. */
  37. _onToggleShow(e) {
  38. this.setData({
  39. isShow: !this.data.isShow,
  40. transparent: false
  41. })
  42. },
  43. /**
  44. * 导航页面跳转
  45. */
  46. _onTargetPage(e) {
  47. let urls = App.getTabBarLinks();
  48. wx.switchTab({
  49. url: '/' + urls[e.detail.target.dataset.index]
  50. });
  51. }
  52. }
  53. })