Files
hjsq_admin/.cursor/skills/vue2-route-permission/examples.md
T
2026-10-08 17:48:09 +08:00

66 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Examples
## 模块路由文件示例(`src/router/demo.js`)
```js
import Main from "../views/main";
import DemoList from "../views/demo/list";
import DemoConfig from "../views/demo/config";
const DemoRouter = {
path: "/demo",
component: Main,
title: "示例管理",
icon: "el-icon-menu",
meta: {
keepAlive: true
},
children: [
{
path: "/demo-list",
component: DemoList,
name: "demoList",
title: "示例列表",
meta: {
title: "示例列表",
keepAlive: true
}
},
{
path: "/demo-config",
component: DemoConfig,
name: "demoConfig",
title: "示例配置",
meta: {
title: "示例配置",
keepAlive: true
}
}
]
};
export default DemoRouter;
```
## 聚合接入示例(`src/router/permissionRouter.js`)
```js
import DemoRouter from "./demo";
const authRouter = [
// ...existing routers
DemoRouter
];
export default authRouter;
```
## 路由排查最小步骤
```js
// 1. 看 router 文件是否 export default
// 2. 看 permissionRouter 是否 import + push
// 3. 看 path/name/title/meta.title 是否齐全
// 4. 看页面组件路径是否正确
```