Vue 动态路由传值

一.动态路由传值

1.配置动态路由;

const routes = [
//动态路由路径参数以:开头
{ path: '/Content/:aid', component:Content},
]
2.
<router-link :to="'/Shopcontent/'+key">
{{key}}--{{item}}
</router-link>
直接在路径后来设置要传的值

3..在对应的页面通过

this.$route.paramshu获取动态路由的值;
--------------------------------------------------------------------------------------------------------------
二.get传值
1.配置路由
const routes = [
{ path: '/Content', component:Content},
]
2.
<router-link :to="'/Shopcontent?aid='+key">
{{key}}--{{item}}
</router-link>
在<ruter-link>中通过?来传值

3.在对应的页面通过

this.$route.paramshu获取动由的值;
原文地址:https://www.cnblogs.com/changedman/p/9199623.html