前端路由设置通常分为 2 类:
集中配置式路由
这也是早些时候用得最多的方式,比如:
{
"routes": [
{
"path": "/", "component": "./a"},
{
"path": "/list", "component": "./b", "Routes": ["./routes/PrivateRoute.js"]},
{
"path": "/users",
"component": "./users/_layout",
"routes": [
{
"path": "/users/detail", "component": "./users/detail"},
{
"path": "/users/:id", "component": "./users/id"}
]
}
]
}
甚至有的框架把路由和请求数据
融合