Files
sundynix-pets/pets-fe/components/page-layout/index.js
T
Blizzard c2b51f96e0
ci-cd / verify (push) Successful in 6s
ci-cd / deploy (push) Skipped
Fix capsule-aligned navigation and refresh mini program typography
2026-10-04 10:30:17 +08:00

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" });
},
},
});