From d69274dc12886444e83324a1dda5a8f762f35efd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E9=91=AB?= <1219654535@qq.com>
Date: Sun, 7 May 2023 16:38:23 +0800
Subject: [PATCH] chore: Nuxtlink
---
app.vue | 1 +
components/Footer.vue | 4 ++--
components/LocaleNuxtLink.vue | 13 +++++++++++++
components/Typography.vue | 1 -
components/header/nav.vue | 34 ++++++++++++++++++++++++++++------
config/use-nav.ts | 18 +++++++-----------
nuxt.config.ts | 4 ----
pages/index.vue | 14 +++++++-------
8 files changed, 58 insertions(+), 31 deletions(-)
create mode 100644 components/LocaleNuxtLink.vue
diff --git a/app.vue b/app.vue
index 121b100..022e9b7 100644
--- a/app.vue
+++ b/app.vue
@@ -7,6 +7,7 @@ useHead({
class: 'scrollbar-thumb-color-dark-50 scrollbar-track-color-transparent scrollbar-radius-2 scrollbar-thumb-radius-4 scrollbar-w-4px scrollbar scrollbar-rounded',
},
})
+usePreferredDark()
diff --git a/components/Footer.vue b/components/Footer.vue
index 0656069..c619a73 100644
--- a/components/Footer.vue
+++ b/components/Footer.vue
@@ -16,9 +16,9 @@ const footer = useFoot()
{{ $t(col.title) }}
-
+
{{ $t(item.link.name) }}
-
+
diff --git a/components/LocaleNuxtLink.vue b/components/LocaleNuxtLink.vue
new file mode 100644
index 0000000..c862aac
--- /dev/null
+++ b/components/LocaleNuxtLink.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
diff --git a/components/Typography.vue b/components/Typography.vue
index 71a4753..8151ac7 100644
--- a/components/Typography.vue
+++ b/components/Typography.vue
@@ -1,6 +1,5 @@
-
+
{{ $t(nav.title) }}
-
+
+
+
+
+ {{
+ locale.code
+ }}
+
+
+
diff --git a/config/use-nav.ts b/config/use-nav.ts
index 8753524..6c94fa6 100644
--- a/config/use-nav.ts
+++ b/config/use-nav.ts
@@ -10,14 +10,10 @@ interface NavMenu {
}
export function useNav(): NavMenu[] {
- const { locale } = useI18n()
-
- const path = locale.value === 'zh' ? '/' : `/${locale.value}`
-
return [
{
title: 'nav.home',
- href: `${path}`,
+ href: '/',
},
{
title: 'nav.solutions.t',
@@ -25,21 +21,21 @@ export function useNav(): NavMenu[] {
{
title: 'nav.solutions.child.land.service[0]',
subtitle: 'nav.solutions.child.land.description[0]',
- href: `${path}/land`,
+ href: '/land',
icon: 'i-solar-airbuds-left-bold-duotone',
iconColor: 'red',
},
{
title: 'nav.solutions.child.land.service[1]',
subtitle: 'nav.solutions.child.land.description[1]',
- href: `${path}/land`,
+ href: '/land',
icon: 'i-solar-airbuds-left-bold-duotone',
iconColor: 'amber',
},
{
title: 'nav.solutions.child.land.service[2]',
subtitle: 'nav.solutions.child.land.description[2]',
- href: `${path}/land`,
+ href: '/land',
icon: 'i-solar-airbuds-left-bold-duotone',
iconColor: 'amber',
},
@@ -47,7 +43,7 @@ export function useNav(): NavMenu[] {
},
{
title: 'nav.news',
- href: `${path}/news`,
+ href: '/news',
},
{
title: 'nav.event.t',
@@ -55,14 +51,14 @@ export function useNav(): NavMenu[] {
{
title: 'nav.event.child.act[0]',
subtitle: 'nav.event.child.description[0]',
- href: `${path}/land`,
+ href: '/land',
icon: 'i-solar-airbuds-left-bold-duotone',
iconColor: 'red',
},
{
title: 'nav.event.child.act[1]',
subtitle: 'nav.event.child.description[1]',
- href: `${path}/land`,
+ href: '/land',
icon: 'i-solar-airbuds-left-bold-duotone',
iconColor: 'red',
},
diff --git a/nuxt.config.ts b/nuxt.config.ts
index d67db0c..b9d6df1 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -66,10 +66,6 @@ export default defineNuxtConfig({
file: 'zh-CN.json',
},
],
- detectBrowserLanguage: {
- useCookie: true,
- cookieCrossOrigin: true,
- },
lazy: true,
langDir: 'locales',
defaultLocale: 'zh',
diff --git a/pages/index.vue b/pages/index.vue
index 46a7a92..7a03445 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -31,7 +31,7 @@ const sectionNine = useSectionNine()
-
-
+
@@ -70,9 +70,9 @@ const sectionNine = useSectionNine()
/>
-
+
{{ $t(sectionThree.link.name) }}
-
+
@@ -125,11 +125,11 @@ const sectionNine = useSectionNine()
{{ $t(item.description) }}
-
+
{{ $t(item.link.name) }}
-
+
@@ -178,7 +178,7 @@ const sectionNine = useSectionNine()
-