index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // nova-tourism/components/template1/headerComponent/index.js
  2. let {
  3. statusBarHeight,
  4. screenHeight,
  5. safeArea: {
  6. bottom
  7. }
  8. } = wx.getSystemInfoSync();
  9. statusBarHeight = Math.abs(statusBarHeight)
  10. let custom = wx.getMenuButtonBoundingClientRect();
  11. let customBarHeight = custom.bottom + custom.top - statusBarHeight;
  12. customBarHeight = Math.abs(customBarHeight)
  13. Component({
  14. /**
  15. * 组件的属性列表
  16. */
  17. properties: {
  18. imgUrls:Array,
  19. title:String,
  20. // 0美食,1民宿
  21. active:{
  22. type:Number,
  23. value:-1
  24. }
  25. },
  26. /**
  27. * 组件的初始数据
  28. */
  29. data: {
  30. statusBarHeight,
  31. customBarHeight,
  32. screenHeight,
  33. },
  34. /**
  35. * 组件的方法列表
  36. */
  37. methods: {
  38. goUrl(e){
  39. let url = ''
  40. // data-url="/nova-tourism/pages/template-2/searching/index"
  41. let {active} = this.properties
  42. if(active==0){
  43. url ='/nova-tourism/pages/food-list/index'
  44. }else if(active==1){
  45. url = '/nova-tourism/pages/homestay/hotel-list/index'
  46. }else{
  47. url = '/nova-tourism/pages/template-2/searching/index'
  48. }
  49. wx.navigateTo({
  50. url: url,
  51. })
  52. },
  53. }
  54. })