const app = getApp() Component({ properties: { background: { type: String, value: '#F4F5F9' }, color: { type: String, value: '#000' }, text: { type: String, value: 'Wechat' }, showLocationIf: { type: Boolean, value: false }, back: { type: Boolean, value: false }, home: { type: Boolean, value: false }, }, data: { array: ['A广场', 'B广场-北京西单'], index: 1, statusBarHeight: app.statusBarHeight + 'px', navigationBarHeight: (app.statusBarHeight + 44) + 'px', }, methods: { backHome: function () { let url = app.globalData.goHomeUrl wx.switchTab({ url: url, }) }, bindPickerChange: function (e) { console.log('picker发送选择改变,携带值为', e.detail.value) this.setData({ index: e.detail.value }) }, back: function () { wx.navigateBack({ delta: 1 }) // const pages = getCurrentPages(); // console.log(`页面栈:${JSON.stringify(pages)}`, pages.length); // if (pages.length === 2) { // wx.navigateBack({ // delta: 1 // }); // } else if (pages.length === 1) { // wx.reLaunch({ // url: '/pages/theme/index1/index', // }) // } else { // wx.navigateBack({ // delta: 1 // }); // } } }, attached: function () { let pages = getCurrentPages(); if (pages.length <= 1) { this.setData({ back: false }) } } })