Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

vue页面中子页面路由应该如何配置?

image.png
当前页面下(用例管理),点击添加用例跳转到新页面,但是我在路由中将这个添加用例页面写在用例管理的children里,用例管理会被认为是1级菜单,添加用例页面就变成了2级菜单。想请教正确的路由应该如何写?用的是elementui
image.png
这是路由


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

1.首先首页是根目录放在最外面
2.其次用例管理为子路由,放在children里。
3.用例管理的add功能为用例管理的,所以add应该放在useCase下面。例如path:'useCase/add'。
下面是举的例子(全部都是children里的)。

{
    path: 'sysconfig/roles',
    name: '/sysconfig/roles',
    meta: {
        title: '角色管理',
    },
    component: () =>
        import('@/views/roles/bydRoles'),
},
{
    path: 'sysconfig/roles/edit',
    name: '/sysconfig/rolesEdit',
    meta: {
        title: '编辑角色管理',
    },
    component: () =>
       import('@/views/roles/bydRolesEdit'),
},

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...