[英]How can I fetch two consecutive array objects simultaneously with ng-repeat
[英]How can I post two objects simultaneously with axios?
我有這樣的問題; 我想用axios同時發布兩個對象,但我發現它不是用下面的代碼。 你覺得我怎么能同時發布兩個對象?
let companyAry = this.toFormData(this.company[0]);
let productsAry = this.toFormData(this.basket[0]);
axios.post('http://localhost/post', companyAry, productAry)
.then(response => {
console.log(response.data.message);
});
您可以將公司和購物籃對象合並為一個父對象。
let params = {
companyData: companyAry,
productData: productAry
}
let res = await axios.post('your url in here', params);
嘗試這個:
var output = Object.assign(companyAry, productsAry );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.