1.配置动态路由
const routes=[
{
path:’/content/:id’, //动态路径参数,以冒号开头
component:content
}]
2.在跳转路径设置参数,不用传参数名
<router-link tag="li" :to="'./content/'+index">
{{item.title}}
</router-link>
3.在对应的页面获取动态路由参数
this.$route.params
Get传值
1.配置路由
routes=[{
path:’/detail’,
component:detail
}]
2.在跳转路径设置参数,要传参数名
<router-link :to="'./detail?id='+index">{{item}}</router-link>
3.在对应的页面获取动态路由参数
this.$route.query