vue Setting Default Home Page Actions
- 2021-08-06 20:16:50
- OfStack
In router. js, the settings are as follows:
index is the default page
const routes = [
// Corporate projects
{ path: '/', redirect: '/index' },
{path:'/index',component:index},
{
path:'/example',
component:example,
redirect:'/edetail',
children:[
{path:'/edetail',component:edetail}
]
},
{path:'/login',component:login}
]
Without setting router in the root directory, it is easy to have problems when jumping pages with different header information
Additional knowledge: vue-router default home page rendering settings
When a page of an vue project opens, there must always be a default home page component that appears automatically
You can't just click on the jump on the home page to appear
This default open route configuration requires changing the routes array in the VueRouter instance in router. js
const router = new VueRouter({
routes:[
{
path:'/',
//redirect Is a redirection
redirect:'/home'
},
{
path:'/home',
component:Home
}
]
})
After this setting, the default routing path is set to/home