提交正式官网

This commit is contained in:
parkiss
2026-07-09 14:35:32 +08:00
parent 5efbd6760e
commit e09f0eccda
792 changed files with 91499 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import type { RouterConfig } from '@nuxt/schema'
import type { RouteRecordRaw } from 'vue-router'
function shouldDuplicateRoute(path: string): boolean {
if (path.startsWith('/admin')) return false
if (path.startsWith('/zh')) return false
if (path.includes('pathMatch')) return false
return true
}
function duplicateRouteForZh(route: RouteRecordRaw): RouteRecordRaw {
const zhPath = route.path === '/' ? '/zh' : `/zh${route.path}`
return {
...route,
path: zhPath,
name: route.name ? `${String(route.name)}-zh` : undefined,
children: route.children?.map(duplicateRouteForZh)
}
}
export default {
routes: (routes) => {
const zhRoutes = routes
.filter((route) => shouldDuplicateRoute(route.path))
.map(duplicateRouteForZh)
return [...routes, ...zhRoutes]
}
} satisfies RouterConfig