navbar.js 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. const app = getApp()
  2. Component({
  3. properties: {
  4. navbarData: { //navbarData 由父页面传递的数据,变量名字自命名
  5. type: Object,
  6. value: {},
  7. observer: function (newVal, oldVal) {}
  8. }
  9. },
  10. data: {
  11. height: '',
  12. //默认值 默认显示左上角
  13. navbarData: {
  14. // showCapsule: 1
  15. }
  16. },
  17. attached: function () {
  18. // 获取是否是通过分享进入的小程序
  19. this.setData({
  20. share: app.globalData.share
  21. })
  22. // 定义导航栏的高度 方便对齐
  23. this.setData({
  24. height: app.globalData.StatusBar
  25. })
  26. },
  27. methods: {
  28. // 返回上一页面
  29. _navback() {
  30. wx.navigateBack({
  31. delta: 1,
  32. fail:function (fail) {
  33. console.log(fail);
  34. }
  35. })
  36. },
  37. //返回到首页
  38. _backhome() {
  39. wx.switchTab({
  40. url: '/pages/index/index',
  41. })
  42. }
  43. }
  44. })