navbar.js 870 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // components/navbar/navbar.ts
  2. // 获取应用实例
  3. const app = getApp();
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. navbarData: { // 由父页面传递的数据
  10. type: Object,
  11. value: {},
  12. },
  13. callback: {
  14. type: Boolean,
  15. value: false
  16. },
  17. },
  18. externalClasses: ['nav-bgc-class', 'nav-title-class'],
  19. options: {
  20. multipleSlots: true,
  21. },
  22. /**
  23. * 组件的初始数据
  24. */
  25. data: {
  26. navBarHeight: app.globalData.navBarHeight,
  27. MenuButtonheight: app.globalData.MenuButtonheight,
  28. MenuButtonTop: app.globalData.MenuButtonTop,
  29. },
  30. /**
  31. * 组件的方法列表
  32. */
  33. methods: {
  34. _navback() {
  35. if (this.properties.callback) {
  36. this.triggerEvent('callback',); // 触发确定事件
  37. return;
  38. };
  39. wx.navigateBack({
  40. delta: 1
  41. });
  42. }
  43. },
  44. })