[Vuejs]-Use dynamic name as param Vuejs

1👍

this.debounce("search_fullname", 5);

debounce(searchField, value) {
  this.$router.push({
    query: {
      ...this.$route.query,
      [searchField]: value <--- Dynamic key in js object
    }
  })
}

You shall get /?search_fullname=5 instead of /?searchField=5 in the url.

Leave a comment