Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 2
    I liked this answer the best. Unfortunately this causes Error: Avoided redundant navigation to current location Commented Jun 25, 2020 at 16:49
  • 1
    Fix: this.$router.push({ query: Object.assign({...this.$route.query}, { new: 'param' }) }) Commented Jun 25, 2020 at 16:59
  • 3
    But now that I think about it you can just do this.$router.push({ query: {...this.$route.query,new: 'param'},) }) Commented Jun 25, 2020 at 17:01
  • How do you access this.$route.query in vue3 composition API ? Commented Jun 14, 2022 at 13:15
  • 1
    @iiiml0sto1 Something like: js import { useRouter, useRoute } from 'vue-router'; const router = useRouter(); const route = useRoute(); // then in your logic const query = Object.assign(route.value.query, { new: 'param' }); router.value.push({ query }); Commented Jun 17, 2022 at 22:28