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

1.引入方式不同 query要用path来引入 this.$router.push({ path: 'test', query: { type: 2, detail: '哈哈' } }) params要用name来引入...

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





  • 发表于 2019-12-25 13:21
  • 阅读 ( 109 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除