动态传参(补)

query:缓存

this.router.push({
    path:'/xxx',query:{id:id}
})
 接受参数: this.route.query.idpost

params:this

this.$router.push({ name:'路由名称',params:{id:id} }).net

接受参数:this.$route.params.id3d

params传参,push只能是name:'xxx',不能是pathrouter

两者还有一点区别就是 query至关于get请求地址栏能够看到请求参数, params至关于post参数在地址栏不会显示路由

js: get请求会有缓存 post从新请求 get请求大小2kbget

相关文章
相关标签/搜索