Skip to content

Commit ba28c3c

Browse files
committed
feat: upgrade to Nuxt v4
1 parent 4a5223d commit ba28c3c

File tree

11 files changed

+1680
-976
lines changed

11 files changed

+1680
-976
lines changed

app/components/AppHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { t } = useI18n()
1616
const title = computed(() => {
1717
if (!route.meta)
1818
return ''
19-
return route.meta.i18n ? t(route.meta.i18n) : (route.meta.title || '')
19+
return route.meta.i18n_key ? t(route.meta.i18n_key) : (route.meta.title || '')
2020
})
2121
2222
const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name))
@@ -26,7 +26,7 @@ const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route
2626
<VanNavBar
2727
:title="title"
2828
:left-arrow="!showLeftArrow"
29-
placeholder clickable fixed
29+
clickable placeholder fixed
3030
@click-left="onBack"
3131
/>
3232
</template>

app/pages/counter/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import useCounter from '~/composables/counter'
33
44
definePageMeta({
55
title: '🍍 持久化 Pinia 状态',
6-
i18n: 'menu.persistPiniaState',
6+
i18n_key: 'menu.persistPiniaState',
77
})
88
99
const counter = useCounter()

app/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Locale } from 'vant'
77
definePageMeta({
88
layout: 'default',
99
title: '主页',
10-
i18n: 'menu.home',
10+
i18n_key: 'menu.home',
1111
})
1212
1313
const color = useColorMode()

app/pages/keepalive/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ definePageMeta({
77
name: 'Keepalive',
88
keepalive: true,
99
title: '🧡 KeepAlive',
10-
i18n: 'menu.keepAlive',
10+
i18n_key: 'menu.keepAlive',
1111
})
1212
1313
const value = ref(1)

app/pages/profile/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
definePageMeta({
33
layout: 'default',
44
title: '我的',
5-
i18n: 'menu.profile',
5+
i18n_key: 'menu.profile',
66
})
77
</script>
88

app/pages/prose/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useProseStore } from '~/stores/prose'
44
definePageMeta({
55
layout: 'default',
66
title: '随笔',
7-
i18n: 'menu.fetch',
7+
i18n_key: 'menu.fetch',
88
})
99
1010
const proseStore = useProseStore()

app/pages/unocss/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
definePageMeta({
33
title: '🎨 Unocss 示例',
4-
i18n: 'menu.unocssExample',
4+
i18n_key: 'menu.unocssExample',
55
})
66
</script>
77

app/types/vue-router.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare module 'vue-router' {
33
/** page title */
44
title?: string
55
/** i18n key */
6-
i18n?: string
6+
i18n_key?: string
77
}
88
}
99

nuxt.config.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export default defineNuxtConfig({
6060

6161
i18n: {
6262
locales: currentLocales,
63-
lazy: true,
6463
strategy: 'no_prefix',
6564
detectBrowserLanguage: {
6665
useCookie: true,
@@ -69,11 +68,6 @@ export default defineNuxtConfig({
6968
defaultLocale: 'zh-CN',
7069
// Reletive to the i18n directory
7170
vueI18n: './i18n.config.ts',
72-
73-
bundle: {
74-
// https://github.com/nuxt-modules/i18n/issues/3238#issuecomment-2672492536
75-
optimizeTranslationDirective: false,
76-
},
7771
},
7872

7973
app: {
@@ -130,9 +124,5 @@ export default defineNuxtConfig({
130124
},
131125
},
132126

133-
future: {
134-
compatibilityVersion: 4,
135-
},
136-
137-
compatibilityDate: '2024-09-24',
127+
compatibilityDate: '2025-07-18',
138128
})

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nuxt-vant-mobile",
33
"type": "module",
44
"version": "0.5.0",
5-
"packageManager": "pnpm@10.12.4",
5+
"packageManager": "pnpm@10.13.1",
66
"engines": {
77
"node": ">=20.19.0"
88
},
@@ -20,37 +20,37 @@
2020
},
2121
"dependencies": {
2222
"@nuxtjs/color-mode": "^3.5.2",
23-
"@nuxtjs/i18n": "^9.5.6",
24-
"nuxt": "^3.17.6",
23+
"@nuxtjs/i18n": "^10.0.0",
24+
"nuxt": "^4.0.0",
2525
"pinia-plugin-persistedstate": "^4.4.1",
2626
"vue": "^3.5.17",
2727
"vue-router": "^4.5.1"
2828
},
2929
"devDependencies": {
30-
"@antfu/eslint-config": "^4.16.2",
30+
"@antfu/eslint-config": "^4.17.0",
3131
"@commitlint/cli": "^19.8.1",
3232
"@commitlint/config-conventional": "^19.8.1",
3333
"@iconify-json/carbon": "^1.2.10",
34-
"@nuxt/eslint": "^1.5.2",
34+
"@nuxt/eslint": "^1.6.0",
3535
"@pinia/nuxt": "^0.11.1",
3636
"@unocss/eslint-plugin": "66.3.3",
3737
"@unocss/nuxt": "66.3.3",
3838
"@vant/nuxt": "^1.0.7",
3939
"bumpp": "^10.2.0",
40-
"eslint": "^9.30.1",
40+
"eslint": "^9.31.0",
4141
"eslint-plugin-format": "^1.0.1",
4242
"lint-staged": "^16.1.2",
4343
"pinia": "^3.0.3",
4444
"postcss-mobile-forever": "^5.0.0",
4545
"simple-git-hooks": "^2.13.0",
4646
"typescript": "~5.8.3",
47-
"vant": "^4.9.20",
48-
"vue-tsc": "^3.0.1"
47+
"vant": "^4.9.21",
48+
"vue-tsc": "^3.0.2"
4949
},
5050
"pnpm": {
5151
"peerDependencyRules": {
5252
"allowedVersions": {
53-
"vue-tsc": "3.0.1"
53+
"vue-tsc": "3.0.2"
5454
}
5555
},
5656
"allowedDeprecatedVersions": {
@@ -72,7 +72,7 @@
7272
]
7373
},
7474
"resolutions": {
75-
"vite": "^7.0.3"
75+
"vite": "^7.0.5"
7676
},
7777
"simple-git-hooks": {
7878
"pre-commit": "pnpm lint-staged",

0 commit comments

Comments
 (0)