reactjs - 将 allvalues 和 formData 中的值放入单个数组中反应 js
问题描述
我正在尝试将 allvalues 和 formData 中的值传递到单个数组中,并通过 react axios 传递它
constructor(props) {
super(props);
this.state = {
allValues: {
name: "",
class: "",
school: "",
},
files: {
car: null,
bus: null,
scooter: null,
},
};
let formData = new FormData();
formData.append("antenatalChart", this.state.files.car);
axios.post("url",
formData, //appand formdata and allValues
{
headers: {
Authorization: `token ` + localStorage.getItem("token"),
"Content-type": "multipart/form-data",
},
}
)
.then((res) => {
console.log(`Success` + res.data);
})
我正在尝试将 allvalues 和 formData 中的值传递到单个数组中并通过反应传递
解决方案
看看这里。这将帮助您了解如何处理表单中的多个输入。
推荐阅读
- keras - 在 ResNet50 Keras 中对自定义类进行分类(基本上是对冰淇淋的类型进行分类)
- python-3.x - 这是一个带有解决方案的练习,请在此向我解释一个 if 语句
- python - 遍历所有列表订单
- postgresql - 无法确定 postgres 超时的起源
- python - to_csv 不保存所有行?
- parallel-processing - 并行编程和计算
- python - 如何在 discord.py 中的某个时间间隔后向用户发送直接消息?
- python-3.x - askdirectory (tkinter) 中的选项“mustexist=False”
- android-studio - FLUTTER项目实施的一个问题
- asp.net - 在 WebMethod 中获取呼叫者 IP