我具有以下功能:
const sendMyPhoto = ({ token, data }) => {
console.log(typeof data) // Its returns: object
console.log(data.length) // Its returns: 0
console.log(data)
/**
its returns the correct data:
[ 0: {annoucements_id: "105", image: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD…
m2XmfQfRt68zSYlJyzaO5+yc/E2If3OITlHXo/qGvT1jon//Z"}
1: {annoucements_id: "105", image: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD…
+cr5yvnK+cr5yvnK+cr5yuV85Xzlcr5yvnK+cr/FfOXP/2Q=="}
length: 2
__proto__: Array(0) ]
**/
return Http.post(`/api/vehicle/image/`, data, { headers: { Authorization: 'Bearer ' + token } })
}
我不知道发生了什么。当console.log(data)
返回正确的数据时,为什么data.length返回0,并且axios发送空数组。