name 传参
router/index.js
export default [
{
path: '/',
name:'Hello',
component: Hello
}
]
App.vue
{{ $route.name }}
子路由传参
App.vue
<router-link :to="{path:'/Hi', name:'Hi1', params:{username:'zhouyx', id:'888'}}">Hi頁面一</router-link>
H1.vue 子页面
<h1>{{msg}} {{$route.params.username}} {{$route.params.id}}</h1>