User ID: {{ $route.params.id }}
```
### 嵌套路由
```javascript
// router/index.js
const routes = [
{
path: '/user/:id',
component: () => import('../views/User.vue'),
children: [
{
path: '',
name: 'UserProfile',
component: () => import('../views/UserProfile.vue')
},
{
path: 'posts',
name: 'UserPosts',
component: () => import('../views/UserPosts.vue')
},
{
path: 'settings',
name: 'UserSettings',
component: () => import('../views/UserSettings.vue')
}
]
}
];
```
```vue