- 重定向:
{
path:"*",
redirect:"/home"
}
- 二级路由(嵌套):
{
path: '/File',
component: File,
children: [
{
path: '/File/nowplaying',
component: Nowplaying
},
{
path: 'comingsoon', // 不能加/!
component: Comingsoon
},
//用户体验
{
path: '',
redirect: '/File/nowplaying'
}
]
},
组件位置:
import Comingsoon from '../views/File/Comingsoon'
import Nowplaying from '../views/File/Nowplaying'
File.vue组件:
<template>
<div>
<div>轮播</div>
<div>file-header</div>
<router-view></router-view>
</div>
</template>