主页面代码
account.vue
<template>
<div>
<h1>这是主页面组件<h1>
<router-link to="/account/login">登录</router-link>
<router-link to="/account/register">注册</router-link>
<router-view></router-view>
</div>
</template>
login.vue
<template>
<div>
<h1>这是登录页面<h1>
</div>
</template>
register.vue
<template>
<div>
<h1>这是注册页面<h1>
</div>
</template>
index.js
const routes = [
{
path: '/all',name:'all',
component:all,
children:[
//使用children属性,实现子路由,子路由的path前面不要加/,否则永远以根路劲请求
{path:'first',component:first},
{path:'second',component:second},
{path:'third',component:third},
]
}
]