合并路由的query参数

sgj191024 / 2023-08-06 / 原文

点击三级分类跳转的时候带上了query参数,然后再次点击关键字搜索,需要把keyword和原来的参数合并

 console.log("qury",this.$route.query);
            let query = JSON.parse(JSON.stringify(this.$route.query))
            query.keyword = this.keyword
            this.$router.push({
                name:"search",
                query:query
            })

深拷贝实现