| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- if (!Math) {
- StatusBar();
- }
- const StatusBar = () => "./StatusBar.js";
- const _sfc_main = {
- __name: "index",
- props: {
- title: { type: String },
- hideLeft: { type: Boolean, default: false },
- warn: { type: Boolean, default: false },
- // 警告
- shadow: { type: Boolean, default: false }
- // 警告
- },
- setup(__props) {
- const systemInfo = common_vendor.index.getWindowInfo();
- let menuButtonInfo = {};
- menuButtonInfo = common_vendor.index.getMenuButtonBoundingClientRect();
- const props = __props;
- const slots = common_vendor.useSlots();
- const getIsHome = common_vendor.computed(() => {
- const pages = getCurrentPages();
- return pages.length >= 2;
- });
- const ifShowRight = common_vendor.computed(() => slots.right || props.warn);
- const statusBarHeight = common_vendor.computed(() => systemInfo.statusBarHeight);
- const getNavWrapStyle = common_vendor.computed(() => {
- const { windowWidth } = systemInfo;
- const { top, right, height } = menuButtonInfo;
- return {
- padding: `${top - common_vendor.unref(statusBarHeight)}px ${windowWidth - right}px`,
- height: `${height + (top - common_vendor.unref(statusBarHeight)) * 2}px`
- };
- });
- const getNavBarContent = common_vendor.computed(() => {
- const { width } = menuButtonInfo;
- const style = {};
- if (common_vendor.unref(ifShowRight)) {
- style.paddingRight = width + "px";
- } else {
- style.position = "absolute";
- style.width = "100%";
- style.top = "0";
- style.bottom = "0";
- style.zIndex = "-1";
- style.padding = `0 ${width + 10}px`;
- }
- return style;
- });
- function go(type) {
- switch (type) {
- case "back":
- common_vendor.index.navigateBack();
- break;
- case "home":
- common_vendor.index.reLaunch({
- url: "/pages/index/index"
- });
- break;
- default:
- common_vendor.index.navigateTo({ url: type });
- break;
- }
- }
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: !__props.hideLeft
- }, !__props.hideLeft ? {
- b: common_vendor.o(($event) => go("back")),
- c: common_vendor.o(($event) => go("home")),
- d: !getIsHome.value ? 1 : ""
- } : {}, {
- e: common_vendor.t(__props.title),
- f: ifShowRight.value
- }, ifShowRight.value ? {} : {}, {
- g: ifShowRight.value ? 1 : "",
- h: common_vendor.s(getNavBarContent.value),
- i: common_vendor.s(getNavWrapStyle.value),
- j: __props.shadow ? 1 : ""
- });
- };
- }
- };
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1633aa0e"]]);
- wx.createComponent(Component);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/components/NavBar/index.js.map
|