我向你解释我的问题,我有一个包含几个对象的表
在这个表格下
{id:1,title:"Campus (Pinte)", desc:"Pression - Bière Blonde - 4° Alc", detail:"Une bière blonde légère qui saura vous désaltérer comme il se doit", qty:"50 cl", img:Campus, price: 5, ctg:1, },
我目前正在像这样发布我的整个表格
postbackend = () =>{
const config = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({...this.state, items:this.props.items}),
};
const url = entrypoint + "/alluserpls";
fetch(url, config)
.then(res => res.json())
.then(res => {
if (res.error) {
alert(res.error);
} else {
alert(`ajouté avec l'ID ${res}!`);
}
}).catch(e => {
console.error(e);
}).finally(()=>this.setState({ redirect: true }));
}
我只想发布我的桌子上没有总计的任何对象
例如我只想恢复标题数量和价格
你有一个想法怎么做。? 谢谢内夫