title: VueJs - How to set dynamic params with axios
body: <p>I have a case like this</p>
  
  <p>first i GET data from the server, then the response is</p>
  
  <pre><code>{
   data: {
     id: 4,
     status: A,
     items: {
       child: [
         {
           id: 28,
           product_id: 1
         },
         {
           id: 33,
           product_id: 4
         }
       ]
     }
   },
   status: 200,
   error: 0
  }
  </code></pre>
  
  <p>after that, the data response I want to take the array items.child to be sent as parameters in POST.
  and here is the format of params to set in POST :</p>
  
  <pre><code>item_id : data.id
  item_status: data.status
  item_combo_28_0: 1|0
  item_combo_33_1: 4|1
  </code></pre>
  
  <p>item_combo is dynamic params get from response data</p>
  
  <p>nb: item_combo_(child.id)_index : child.product_id | index</p>
  
  <p>here my axios code</p>
  
  <pre><code>getData() {
    let headers = {
      Authorization: 'Bearer ' + window.accessToken
    }
    let id = val
    axios({
      method: 'GET',
      url: BASE_API('productcombo/' + id),
      headers: headers
    })
      .then(response =&gt; {
        this.itemCombo = []
        this.dataResponse = response.data.data
        this.setItemPackage()
        this.loading = false
      })
      .catch(error =&gt; {
        this.loading = false
      })
  },
  setItemPackage() {
    if (this.dataResponse.items.child.length &gt; 0) {
      this.dataResponse.items.child.map((row, idx) =&gt; {
        this.$set(row, 'item_combo_' + row.id + '_' + [idx], row.product_id + '|' + idx)
        this.itemCombo.push(row)
        console.log(this.itemCombo)
      })
    }
  }
  </code></pre>
  
  <p>expected: How to set array variabel for (item_combo_?) to set in dynamic params of POST</p>
  
  <p>here my POST code</p>
  
  <pre><code>sendData() {
    this.loadingPackage = true
    let headers = {
      Authorization: 'Bearer ' + window.accessToken
    }
    let data = {
      item_id: this.dataResponse.id,
      item_tatus: this.dataResponse.status,
  
      ======= Here my expect =========
      item_combo_27_0: 13 | 0,
      item_combo_3_1: 15 | 0
      ================================
    }
    axios({
      method: 'POST',
      url: BASE_API('openorder/additemcombo'),
      headers: headers,
      data: data
    })
      .then(response =&gt; {
        this.result = response.data
        }
        if (response.data.error) {
          this.$message({
            message: 'Error Network',
            type: 'error'
          })
        }
      })
      .catch(() =&gt; {
        this.$notify({
          message: 'Error Connections',
          type: 'warning'
        })
      })
  },
  </code></pre>