[TOC]
### Vue 動態路由
router.js
~~~
{
// 動態參數路由
path: '/detail/:id',
name: 'detail',
component: () => import('../views/Detail.vue')
}
~~~
Detail.vue
~~~
<template>
<div>
當前訪問url參數ID 為:
{{ $route.params.id }}
</div>
</template>
~~~
>[danger] $route 當前路由對象,動態路由只需要傳遞不同的參數,即可在所有組件中通過當前路由對象獲取