I want to default to a specific page when user navigates to the root path ie when used goes to myapp.com I want to redirect them to myapp.com/defaultpage
My current code is
index.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 } } ]})
As it is when user goes to myapp.com I get a '404 page not found' - ie the NotFoundComponent. Only when I type in myapp.com/defaultview can I get to the correct page.
Any ideas?
Try this code:
routes: [ { path: '/', redirect: '/defaultview' }, { path: '/defaultview', name: 'defaultview', component: DefaultView }, { path: '*', component: NotFoundComponent } ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With