当用户导航到根路径时,我希望默认为特定页面
我现在的代码是
指数js
import Full from '../containers/Full'
import DefaultView from '../views/DefaultView'
export default new Router({
mode: 'history',
linkActiveClass: 'open active',
scrollBehavior: () => ({ y: 0 }),
routes: [
{
path: '/',
redirect: '/defaultview',
name: 'home',
component: Full,
children: [
{
path: '/defaultview',
name: 'defaultview',
component: DefaultView
},
{
path: '*',
component: NotFoundComponent
}
}
]})
当用户转到myapp时就是这样.com我得到一个"404页面未找到"——即NotFound组件.只有当我输入myapp时.com/defaultview我可以进入正确的页面.
有什么 idea 吗?