// nova-tourism/components/template1/headerComponent/index.js let { statusBarHeight, screenHeight, safeArea: { bottom } } = wx.getSystemInfoSync(); statusBarHeight = Math.abs(statusBarHeight) let custom = wx.getMenuButtonBoundingClientRect(); let customBarHeight = custom.bottom + custom.top - statusBarHeight; customBarHeight = Math.abs(customBarHeight) Component({ /** * 组件的属性列表 */ properties: { imgUrls:Array, title:String, // 0美食,1民宿 active:{ type:Number, value:-1 } }, /** * 组件的初始数据 */ data: { statusBarHeight, customBarHeight, screenHeight, }, /** * 组件的方法列表 */ methods: { goUrl(e){ let url = '' // data-url="/nova-tourism/pages/template-2/searching/index" let {active} = this.properties if(active==0){ url ='/nova-tourism/pages/food-list/index' }else if(active==1){ url = '/nova-tourism/pages/homestay/hotel-list/index' }else{ url = '/nova-tourism/pages/template-2/searching/index' } wx.navigateTo({ url: url, }) }, } })