Files
Blizzard 7fc50f9212
ci-cd / verify (push) Successful in 1m54s
ci-cd / deploy (push) Skipped
Add AMap location and weather header with warm mini program theme
2026-10-04 11:03:34 +08:00

39 lines
901 B
JavaScript

const { navigationGeometry } = require("../../utils/layout");
Component({
properties: {
title: String,
subtitle: String,
location: { type: Boolean, value: false },
back: { type: Boolean, value: false },
},
data: navigationGeometry(),
lifetimes: {
attached() {
this.updateLayout();
},
},
pageLifetimes: {
resize() {
this.updateLayout();
},
},
methods: {
locate() {
this.triggerEvent("locationtap");
},
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" });
},
},
});