// components/topbar.js Component({ externalClasses: ['topbar-class', 'topbar-title-class', 'back-color-class'], /** * 组件的属性列表 */ properties: { title: { type: String, value: '' } }, /** * 组件的初始数据 */ data: { }, attached: function() { var url =getCurrentPages()[getCurrentPages().length-1].route let dwObj = wx.getMenuButtonBoundingClientRect() let navHeight_ = (dwObj.top + dwObj.height) let capsuleTop_ = dwObj.top let windowHeight = wx.getSystemInfoSync().windowHeight this.setData({ navHeight: navHeight_, capsuleTop:capsuleTop_, capHeight: dwObj.height, bodyHeight: windowHeight - navHeight_, }); }, /** * 组件的方法列表 */ methods: { handleBack() { let routeLen = getCurrentPages().length; if (routeLen == 1) { wx.reLaunch({ url: '/pages/welfareMall/index/index', }) return } const url =getCurrentPages()[getCurrentPages().length-2].route wx.navigateBack({ delta: -1 }) } } })