簡體   English   中英

使用 axios 發送多個對象

[英]sending multiple objects using axios

如何在 axios 中發送多個對象? 有沒有辦法使用 axios 將數組發送到 API?

這是代碼。

export const addOrderAdmin = (ownerID,array) => api.patch(`/checkout/${ownerID}`,
    {
        delivery: array // array with 2 objects. 
    }
)

對象是這樣的。 在此處輸入圖像描述

可能嗎 ?

你總是可以創建一個嵌套對象數組

例子:

var customerInfo = {
  name: 'bob',
  phone : 'xxx-xxx-xxxx',
  address: [
   {
     id: 1,
     city: 'Buffalo'
   },
   {
     id 2,
     city: 'Houston'
  ]
}

然后你可以只修補 customerInfo 對象,你可以使用帶有點訪問器符號的插值作為 url

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM