# Module Spec：router（路由与权限守卫）

module:
  id: router
  name: 路由与页面组织
  entrypoints:
    - src/router/index.ts
    - src/router/permissions.ts

public_api:
  exports:
    - constantRoutes
    - asyncRoutes
    - setupPermissions(router)

usage_examples:
  - "新增页面：在 src/views/<module>/ 添加 Vue 文件，并在 asyncRoutes 中挂载到 Layout children"

dependency_closure:
  runtime:
    - "router：vue-router（beforeEach/afterEach）"
    - "store-user：token/getUserInfo/resetAll/setVirtualRoles"
    - "store-routes：setRoutes(authentication)"
    - "store-settings：theme.showProgressBar"
    - "config：authentication/loginInterception/routesWhiteList/supportVisit"
    - "utils/pageTitle：getPageTitle(to.meta.title)"
    - "utils/routes：toLoginRoute"
    - "nprogress：VabProgress（含 nprogress.css）"

acceptance:
  - "路由可跳转"
  - "刷新后路由仍可恢复"

pitfalls:
  - "如涉及权限/菜单，需同步 meta（title/icon/...）；同时注意 routesWhiteList/loginInterception/authentication 等开关影响守卫逻辑"
  - "permissions.ts 直接写 document.title；若新项目改为 useHead 等方式需统一"

