defineI18nRoute()
是一个编译宏,您可以使用它为位于 pages/
目录中的 页面 组件设置自定义路由路径(除非 另有设置)。通过这种方式,您可以为 Nuxt 应用程序的每个静态或动态路由设置自定义路由路径。
<script setup>
defineI18nRoute({
paths: {
en: '/about-us',
fr: '/a-propos',
ja: '/about-ja'
}
})
</script>
defineI18nRoute(route: I18nRoute | false) => void
interface I18nRoute {
paths?: Record<Locale, `/${string}`>
locales?: Locale[]
}
false
禁用目标页面组件路由的本地化。
I18nRoute
一个接受以下 i18n 路由设置的对象:
paths
Record<Locale,
/${string}>
locales
Locale[]