94 lines
4.2 KiB
JavaScript
Raw Permalink Normal View History

2025-04-22 15:57:06 +08:00
import __nuxt_component_0 from "../node_modules/nuxt/dist/app/components/nuxt-link.mjs";
2025-04-22 16:46:16 +08:00
import { defineComponent, ref, withCtx, createVNode, toDisplayString, createTextVNode } from "vue";
import { ssrRenderClass, ssrRenderComponent, ssrInterpolate, ssrRenderList } from "vue/server-renderer";
2025-04-22 15:57:06 +08:00
import { useRoute } from "vue-router";
2025-04-22 16:46:16 +08:00
import { useI18n } from "vue-i18n";
import "./LanguageSwitcher.vue.mjs";
import _sfc_main$1 from "./LanguageSwitcher.vue2.mjs";
2025-04-22 15:57:06 +08:00
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "NavBar",
__ssrInlineRender: true,
setup(__props) {
useRoute();
2025-04-22 16:46:16 +08:00
const { t } = useI18n();
2025-04-22 15:57:06 +08:00
const mobileMenuOpen = ref(false);
const scrolled = ref(false);
const navItems = [
2025-04-22 16:46:16 +08:00
{ i18nKey: "nav.home", path: "/" },
{ i18nKey: "nav.products", path: "/products" },
{ i18nKey: "nav.solutions", path: "/solutions" },
{ i18nKey: "nav.cases", path: "/cases" },
{ i18nKey: "nav.about", path: "/about" },
{ i18nKey: "nav.contact", path: "/contact" }
2025-04-22 15:57:06 +08:00
];
return (_ctx, _push, _parent, _attrs) => {
const _component_NuxtLink = __nuxt_component_0;
_push(`<!--[--><nav class="${ssrRenderClass(["bg-primary shadow-md fixed w-full z-50", { "nav-scrolled": scrolled.value }])}"><div class="container"><div class="flex items-center justify-between h-16">`);
_push(ssrRenderComponent(_component_NuxtLink, {
to: "/",
class: "flex items-center text-white"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
2025-04-22 16:46:16 +08:00
_push2(`<i class="fas fa-cloud text-2xl mr-2"${_scopeId}></i><span class="text-xl font-bold"${_scopeId}>${ssrInterpolate(_ctx.$t("common.appName"))}</span>`);
2025-04-22 15:57:06 +08:00
} else {
return [
createVNode("i", { class: "fas fa-cloud text-2xl mr-2" }),
2025-04-22 16:46:16 +08:00
createVNode("span", { class: "text-xl font-bold" }, toDisplayString(_ctx.$t("common.appName")), 1)
2025-04-22 15:57:06 +08:00
];
}
}),
_: 1
}, _parent));
_push(`<div class="hidden md:flex items-center space-x-8"><!--[-->`);
ssrRenderList(navItems, (item, index) => {
_push(ssrRenderComponent(_component_NuxtLink, {
key: index,
to: item.path,
class: ["text-white/85 hover:text-secondary transition-colors duration-300", { "text-white": _ctx.$route.path === item.path }]
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
2025-04-22 16:46:16 +08:00
_push2(`${ssrInterpolate(_ctx.$t(item.i18nKey))}`);
2025-04-22 15:57:06 +08:00
} else {
return [
2025-04-22 16:46:16 +08:00
createTextVNode(toDisplayString(_ctx.$t(item.i18nKey)), 1)
2025-04-22 15:57:06 +08:00
];
}
}),
_: 2
}, _parent));
});
2025-04-22 16:46:16 +08:00
_push(`<!--]-->`);
_push(ssrRenderComponent(_sfc_main$1, null, null, _parent));
_push(`</div><button class="md:hidden text-white p-2 rounded-lg hover:bg-white/10 transition-colors duration-300" aria-label="打开菜单"><i class="fas fa-bars text-xl"></i></button></div><div class="${ssrRenderClass(["md:hidden bg-primary absolute top-16 left-0 right-0 shadow-lg", { "hidden": !mobileMenuOpen.value }])}"><div class="container py-4"><div class="flex flex-col space-y-4"><!--[-->`);
2025-04-22 15:57:06 +08:00
ssrRenderList(navItems, (item, index) => {
_push(ssrRenderComponent(_component_NuxtLink, {
key: index,
to: item.path,
class: ["text-white/85 hover:text-secondary transition-colors duration-300 py-2", { "text-white": _ctx.$route.path === item.path }],
onClick: ($event) => mobileMenuOpen.value = false
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
2025-04-22 16:46:16 +08:00
_push2(`${ssrInterpolate(_ctx.$t(item.i18nKey))}`);
2025-04-22 15:57:06 +08:00
} else {
return [
2025-04-22 16:46:16 +08:00
createTextVNode(toDisplayString(_ctx.$t(item.i18nKey)), 1)
2025-04-22 15:57:06 +08:00
];
}
}),
_: 2
}, _parent));
});
2025-04-22 16:46:16 +08:00
_push(`<!--]--><div class="py-2">`);
_push(ssrRenderComponent(_sfc_main$1, null, null, _parent));
_push(`</div></div></div></div></div></nav><div class="h-16"></div><!--]-->`);
2025-04-22 15:57:06 +08:00
};
}
});
export {
_sfc_main as default
};
//# sourceMappingURL=NavBar.vue2.mjs.map