I want to put the front of the checkBox array to the back end, but the back-end always can't get the array of data, whether also step between analytical data?
///front-end code added to the list of orders
Let postcartData=({https://bbs.csdn.net/topics/this.$qs.stringify
Cart: this checkBox,
}}, {indices: false);
This $axios ({
Method: "post",
Url: '/server/API/buy/add',
Data: JSON. Stringify (postcartData),
Headers: {
'Authorization' : window. LocalStorage [' login ']
},
Params: {
Id: this $store. Getters. Cart
}
}). Then ((res)=& gt; {
The console. The log (' [] added to the list of orders debugging + JSON. Stringify (postcartData))
This. $toast. The message (' create successful order ');
return false;
}). The catch (()=& gt; {
This. $toast. The message (' failed to create an order);
return false;
})
/* *
* the backend interface code
* order list is added to the array cart
* interface:/API/buy/add? Id=adasasdadas
*/
The router. Post ("/add ",
Passport. Authenticate (JWT,} {session: false),
Async CTX=& gt; {
Const id=CTX. Query. Id;
Const buys=await buy. FindById (id);
Const newCart={
Title: CTX. Request. Body. The title,//to get
Img: CTX. Request. Body. Img//to get
Price: CTX. Request. Body. Price,//to get
Num: CTX. Request. Body. Num,//to get
Date: CTX. Request. Body. The date,
};
Buys. Cart. Unshift (newCart);
Const buyUpdate=await buy. FindOneAndUpdate (
{_id: id},
{$set: buys},
{new: true}
);
CTX. Body=JSON. Stringify (buyUpdate);
The console. The log (JSON. Stringify (CTX) request) body))
}
);