navbar.js 825 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. callback: ()=> {},
  13. },
  14. },
  15. externalClasses: ['nav-bgc-class', 'nav-title-class'],
  16. options: {
  17. multipleSlots: true,
  18. },
  19. /**
  20. * 组件的初始数据
  21. */
  22. data: {
  23. navBarHeight: app.globalData.navBarHeight,
  24. MenuButtonheight: app.globalData.MenuButtonheight,
  25. MenuButtonTop: app.globalData.MenuButtonTop,
  26. },
  27. /**
  28. * 组件的方法列表
  29. */
  30. methods: {
  31. _navback() {
  32. if(this.properties.navbarData.callback) {
  33. this.properties.navbarData.callback();
  34. return;
  35. };
  36. wx.navigateBack({
  37. delta: 1
  38. });
  39. }
  40. },
  41. })