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

2022-10-12,,,,

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

 

《【原】vue-router中params和query的区别.doc》

下载本文的Word格式文档,以方便收藏与打印。