0

I have multiple params and when I do a get request I want to have just a function that takes the name of the params its value.

The problem is, the params is as I defined, and not the value.

this.debounce("search_fullname", 5);

debounce(searchField, value) {
  this.$router.push({
    query: {
     ...this.$route.query,
     searchField: value 
    }
  })
 }

In the url I get /?searchField=5 instead of /?search_fullname=5

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.