How to correctly use axios params with arrays

后端 未结 7 482
臣服心动
臣服心动 2021-02-01 14:55

How to add indexes to array in query string?

I tried send data like this:

axios.get(\'/myController/myAction\', { params: { storeIds: [1,2,3] })
<         


        
相关标签:
7条回答
  • 2021-02-01 15:16

    In my case, I am using someting like this

    const params = array.map((v)=>{
                return `p=${v}&`
            })
    

    Only concat params.join('') to the URL where you get data:

    `url_to_get?${params.join('')`
    

    In my back-end in ASP.net I receive this

    [FromUri] string [] p
    
    0 讨论(0)
提交回复
热议问题