34 lines
770 B
JavaScript
34 lines
770 B
JavaScript
const { navigationGeometry } = require("../../utils/layout");
|
|
|
|
Component({
|
|
properties: {
|
|
title: String,
|
|
back: { type: Boolean, value: false },
|
|
},
|
|
data: navigationGeometry(),
|
|
lifetimes: {
|
|
attached() {
|
|
this.updateLayout();
|
|
},
|
|
},
|
|
pageLifetimes: {
|
|
resize() {
|
|
this.updateLayout();
|
|
},
|
|
},
|
|
methods: {
|
|
updateLayout() {
|
|
const info = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync();
|
|
let menu = {};
|
|
try {
|
|
menu = wx.getMenuButtonBoundingClientRect();
|
|
} catch (_) {}
|
|
this.setData(navigationGeometry(info, menu));
|
|
},
|
|
goBack() {
|
|
if (getCurrentPages().length > 1) wx.navigateBack({ delta: 1 });
|
|
else wx.reLaunch({ url: "/pages/home/home" });
|
|
},
|
|
},
|
|
});
|