0
点赞
收藏
分享

微信扫一扫

vue——路由命名

谷中百合517 2022-03-11 阅读 69

在嵌套很多级路由时 跳转就要编写很长的to或path给每个路由命名跳转时直接使用路由的名称即可。但是 只能用在跳转方式为对象的时候

routes: [
	{
		path: '/home',
		component: MyHome,
		children: [
			{
				path: 'news',
				component: MyNews
			},
			{
				path: 'message',
				component: MyMessage,
				children: [
					{
						name: 'HomeMessageDetail',
						path: 'detail',
						component: MyDetail
					},
				]
			},
		]
	},
]
<router-link :to="{name: 'HomeMessageDetail',}"></router-link>
举报

相关推荐

Flutter 命名路由

0 条评论