48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "nav-bar",
|
|
props: {
|
|
title: {},
|
|
showBack: { type: Boolean },
|
|
titleColor: {},
|
|
bgColor: {}
|
|
},
|
|
setup(__props) {
|
|
const statusBarHeight = common_vendor.ref(20);
|
|
const navBarHeight = common_vendor.ref(44);
|
|
common_vendor.onMounted(() => {
|
|
const sysInfo = common_vendor.index.getSystemInfoSync();
|
|
statusBarHeight.value = sysInfo.statusBarHeight;
|
|
const menuButtonInfo = common_vendor.index.getMenuButtonBoundingClientRect();
|
|
navBarHeight.value = (menuButtonInfo.top - sysInfo.statusBarHeight) * 2 + menuButtonInfo.height;
|
|
});
|
|
const handleBack = () => {
|
|
common_vendor.index.navigateBack(new UTSJSONObject({
|
|
fail: () => {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/index/index"
|
|
});
|
|
}
|
|
}));
|
|
};
|
|
return (_ctx, _cache) => {
|
|
"raw js";
|
|
const __returned__ = common_vendor.e({
|
|
a: _ctx.showBack
|
|
}, _ctx.showBack ? {
|
|
b: common_vendor.o(handleBack)
|
|
} : {}, {
|
|
c: common_vendor.t(_ctx.title),
|
|
d: _ctx.titleColor,
|
|
e: common_vendor.unref(navBarHeight) + "px",
|
|
f: common_vendor.unref(statusBarHeight) + "px",
|
|
g: common_vendor.unref(statusBarHeight) + common_vendor.unref(navBarHeight) + "px"
|
|
});
|
|
return __returned__;
|
|
};
|
|
}
|
|
});
|
|
wx.createComponent(_sfc_main);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/nav-bar/nav-bar.js.map
|