From 775ff17fda0260db3038668019c025ab8f975fd6 Mon Sep 17 00:00:00 2001
From: R2m1liA <15258427350@163.com>
Date: Thu, 14 Aug 2025 14:23:06 +0800
Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?=
=?UTF-8?q?=E5=8C=96=E6=9E=84=E5=BB=BABug(=E5=A4=A7=E6=A6=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/app.vue | 23 ++++++++++++++++++++---
app/components/JinshenHeader.vue | 4 ++--
i18n/i18n.config.ts | 5 +++++
nuxt.config.ts | 6 ++++++
4 files changed, 33 insertions(+), 5 deletions(-)
create mode 100644 i18n/i18n.config.ts
diff --git a/app/app.vue b/app/app.vue
index 8e7f33e..b5e4de5 100644
--- a/app/app.vue
+++ b/app/app.vue
@@ -1,7 +1,24 @@
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/components/JinshenHeader.vue b/app/components/JinshenHeader.vue
index c98d003..32a23ad 100644
--- a/app/components/JinshenHeader.vue
+++ b/app/components/JinshenHeader.vue
@@ -31,7 +31,7 @@ v-model="searchQuery" class="search-input" :placeholder="$t('search-placeholder'
- 中文
+ 简体中文
English
@@ -51,7 +51,7 @@ const handleSearch = () => {
if (searchQuery.value.trim()) {
// 这里可以添加搜索逻辑,例如导航到搜索结果页面
console.log('Searching for:', searchQuery.value);
- // 示例:导航到搜索结果页面
+// 示例:导航到搜索结果页面
// router.push({ path: '/search', query: { q: searchQuery.value } });
}
}
diff --git a/i18n/i18n.config.ts b/i18n/i18n.config.ts
new file mode 100644
index 0000000..7aa410a
--- /dev/null
+++ b/i18n/i18n.config.ts
@@ -0,0 +1,5 @@
+export default defineI18nConfig(() => ({
+ legacy: false,
+ locale: 'zh',
+ fallbackLocale: 'zh',
+}))
\ No newline at end of file
diff --git a/nuxt.config.ts b/nuxt.config.ts
index a1b2a1e..4cc0cf7 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -55,11 +55,17 @@ export default defineNuxtConfig({
},
i18n: {
+ detectBrowserLanguage: {
+ useCookie: true,
+ cookieKey: 'i18n_redirected',
+ redirectOn: 'root'
+ },
locales: [
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
{ code: 'zh', language: 'zh-CN', name: '简体中文', file: 'zh.json' },
],
defaultLocale: 'zh',
+ langDir: 'locales'
},
modules: [