我使用 vue-router
进行前端架构设计。
我在这里使用嵌套的 vue-router
。
第一个孩子用于仪表板,第二个孩子用于按每个模块分组。
预期:
告诉我应用程序的最佳路线架构
这是我的代码:
// Routes
export default new Router({
mode: 'history',
routes: [
{
path: 'login',
name: 'login',
component: Login
},
{
path: '/',
redirect: 'dashboard',
name: 'Home',
component: Dashboard,
meta: { requiresAuth: true },
children: [
{
path: 'dashboard',
name: 'Dashboard',
component: DashboardIndex
},
{
path: 'product',
name: 'Products',
component: Product,
children: [
{
path: 'product/:id',
name: 'Product Detail',
component: ProductDetail
},
{
path: 'product-create',
name: 'Product Create',
component: ProductCreate
}]
},
{
path: 'openorder',
name: 'Open-Order',
component: OpenOrder,
children: [
{
path: 'openorder/:id',
name: 'Open Order Detail',
component: OpenOrderDetail
},
{
path: 'openorder-create',
name: 'Open Order Create',
component: OpenOrdeCreate
}]
}
]}
]
})