35 lines
898 B
TypeScript
35 lines
898 B
TypeScript
import { NAV_INNER_PX } from '../../utils/navMetrics';
|
|
|
|
Component({
|
|
options: { multipleSlots: true },
|
|
properties: {
|
|
title: { type: String, value: '' },
|
|
background: { type: String, value: '' },
|
|
},
|
|
data: {
|
|
statusBarHeight: 0,
|
|
navBlockHeight: 0,
|
|
showBackButton: false,
|
|
},
|
|
lifetimes: {
|
|
attached() {
|
|
const { statusBarHeight } = wx.getWindowInfo();
|
|
const pages = getCurrentPages();
|
|
this.setData({
|
|
statusBarHeight,
|
|
navBlockHeight: statusBarHeight + NAV_INNER_PX,
|
|
showBackButton: pages.length > 1,
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
handleBack() {
|
|
wx.navigateBack({
|
|
fail: () => {
|
|
wx.switchTab({ url: '/pages/home/home' });
|
|
},
|
|
});
|
|
},
|
|
},
|
|
});
|