应用场景:通过动态路由参数的模式进行路由匹配
<router-link to="/user/1">User1</router-link>
<router-link to="/user/2">User2</router-link>
<router-link to="/user/3">User3</router-link>
<router-link to="/user/4">User4</router-link>
<router-view></router-view>
const User={
//路由组件通过 $route.params 获取路由参数
template:'<div>User {{ $route.params.id }} </div>'
}
const router = new VueRouter({
routes:[
//动态路径参数,以冒号开头
{path: ' /user/:id',component:User}
]
})
标签:匹配,params,User,const,动态,id,路由 From: https://www.cnblogs.com/wuyunna/p/18078429