const app = getApp() Component({ properties: { navbarData: { //navbarData 由父页面传递的数据 type: Object, value: {}, height: app.globalData.height }, needBack: { type: Boolean, value: true } }, data: { height: '', //默认值 默认显示左上角 navbarData: { } }, attached: function () { // 定义导航栏的高度 方便对齐 this.setData({ height: app.globalData.height }) }, created() { this.setData({ height: app.globalData.height }) }, methods: { // 返回上一页面 _navback() { // wx.navigateBack() this.triggerEvent('back',) } } })