Vue.js 将动态名称用作参数Vuejs

Vue.js 将动态名称用作参数Vuejs,vue.js,vuejs2,Vue.js,Vuejs2,我有多个参数,当我执行get请求时,我只希望有一个函数,该函数将参数的名称作为其值 问题是,参数是我定义的,而不是值 this.debounce("search_fullname", 5); debounce(searchField, value) { this.$router.push({ query: { ...this.$route.query, searchField: value } }) } 在url中,我得到的是/?searchF

我有多个参数,当我执行get请求时,我只希望有一个函数,该函数将参数的名称作为其值

问题是,参数是我定义的,而不是值

this.debounce("search_fullname", 5);

debounce(searchField, value) {
  this.$router.push({
    query: {
     ...this.$route.query,
     searchField: value 
    }
  })
 }
在url中,我得到的是
/?searchField=5
,而不是
/?search\u fullname=5
这个.debounce(“search\u fullname”,5);
this.debounce("search_fullname", 5);

debounce(searchField, value) {
  this.$router.push({
    query: {
      ...this.$route.query,
      [searchField]: value <--- Dynamic key in js object
    }
  })
}
去盎司(搜索字段,值){ 这是$router.push({ 查询:{ …此.$route.query, [搜索字段]:值