第一种
<div>
<router-link to="/i18n/index">Page1</router-link> //再html里面的跳转,路径写全
</div>
路由配置为
{
path: '/i18n',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/i18n-demo/index'),
name: 'I18n',
meta: { title: 'i18n', icon: 'international' }
}
]
},
第二种,事件点击
methods: {
luyou(){
this.$router.push('addTest2')
},
}
路由配置为
{
path: '/mytest',
component: Layout, //在那个框框里
redirect: '/mytest/addTest',
alwaysShow: true,
name: 'mytest',
meta: { title: '添加', icon: 'people' },
children: [//子路由
{
path: 'addTest',
component: () => import('@/views/mytest/addTest'),
name: 'addTest',
meta: { title: '添加页面' }
},
{
path: 'addTest2',
component: () => import('@/views/mytest/addTest2'),
name: 'addTest21',
meta: { title: '添加页面2' }
}