Vue Routes 嵌套路由的匹配问题
发布于 3 年前 作者 feer 1229 次浏览 来自 问答
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利

页面大致是这样的

+-----------------------+
| Department            |
| Info | Setting | Help |
| +-------------------+ |
| | Page              | |
| |                   | |
| +-------------------+ |
+-----------------------+

我现在路由写成这样

{ 
	name: 'Tabs',
	path: '/Tabs/:department/:tab', 
	component: {template: '<v-tabs></v-tabs>'}, 
	children:[
		{ 
			name: 'info',
			path: 'info', 
			component:  { template: '<v-info></v-info>' }, 
		},
		{ 
			name: 'setting',
			path: 'setting', 
			component: { template: '<v-setting></v-setting>' }, 
		},	
		{ 
			name: 'help',
			path: 'help', 
			component: { template: '<v-help></v-help>' }, 
		},					
	]
},

在 v-tabs 中需要 :tab 来识别需要激活的Tab标签,:department 显示在 Department
现在弄出来的链接就像是 /#/Tabs/AAAA/info/info 这样,感觉很丑,有修改建议吗?

回到顶部