mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-23 19:02:52 +08:00
fix(vue-router): admin-template route tables, children and layouts; Nuxt routes only in Nuxt (#2130)
vue-element-admin, vue-admin-template and vben had no routes: their tables
are named arrays (`export const constantRoutes = [...]`, `const routes:
RouteRecordRaw[] = [...]`) or per-module objects (`const tableRouter = {…}`)
handed to `new Router(...)`, and most of their screens are `children`.
The Vue Router reader now reads those tables in any file that builds a
router, imports vue-router or lives in a router/ directory; joins children
onto their parent's path (a parent is a screen only when no child claims
its address and it doesn't redirect); binds a lazy view by the FILE it
imports (all of vue-element-admin's are `…/index.vue`), through an alias the
resolver can't follow by the one file in the app with that path; links each
screen to its parents' components as layouts; and takes `this.$router.push`.
Nuxt's file routes move into their own `nuxt` resolver, detected only in a
Nuxt app: halo's plain-Vue console got 30 made-up screens from its `pages/`
folders. A Nuxt app at the repository root now gets its routes, and a
top-level `pages/index.vue` is `/`, not `/index`.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -218,7 +218,7 @@ function writtenHere(edge: Edge, holder: Node): boolean {
|
||||
* Entry points, which is the list of what a request or a user can arrive at.
|
||||
*/
|
||||
function isScreenRoute(route: Node): boolean {
|
||||
return route.name.startsWith('/') && !route.filePath.includes('/server/api/');
|
||||
return route.name.startsWith('/') && !`/${route.filePath}`.includes('/server/api/');
|
||||
}
|
||||
|
||||
export async function buildScreens(cg: CodeGraph, projectRoot: string): Promise<WireScreensPayload> {
|
||||
|
||||
Reference in New Issue
Block a user