当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 【原】vue-router中params和query的区别

【原】vue-router中params和query的区别

2019年12月24日  | 移动技术网IT编程  | 我要评论

1.引入方式不同

query要用path来引入
this.$router.push({
    path: 'test',
    query: {
        type: 2,
        detail: '哈哈'
    }
})

params要用name来引入

this.$router.push({
    name: 'test',
    query: {
        type: 2,
        detail: '哈哈'
    }
})

 

2.url不同

query在url中显示参数
http://localhost:8080/detail?type=0&detail=哈哈
params在url中不显示参数
http://localhost:8080/detail

 





如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网