vue拼接url参数

vue如何在地址栏拼接url参数:

this.$router.push({path:this.$route.path,query:{参数名:参数值}})

this.$router.push({path:this.$route.path,query:{cityName:location.city}})

如何继续追加url参数:

this.$router.push({path:this.$route.path,query:{...this.$route.query,要添加的参数名:参数值}})

this.$router.push({path:this.$route.path,query:{...this.$route.query,id:1}})

 

posted @ 2022-05-11 12:25  青柠~  阅读(1784)  评论(0)    收藏  举报