내 Vue 응용 프로그램의 다음 코드는 객체를 반환해야 할 때 데이터를 "Array"라는 문자열로 반환합니다. 코드는 간결하게하기 위해 단순화 :Axios가 객체 대신 "Array"라는 문자열을 반환합니다.
Component.vue
import axios from 'axios';
axios.post(URL_HERE)
.then(function(response) {
// success
console.log(response);
})
이 내가 토큰을 가진 객체를 기대하고 있습니다로 잘못 다음을 반환합니다. 나는 같은 방법으로 XMLHttpRequest의()를 사용하는 경우
{data: "Array", status: 200, statusText: "OK", headers: {content-type: "text/plain;charset=UTF-8"}, config: Object, …}
그러나 내가 성공적 후 해요 무엇을 반환합니다. Axios가 "Array"라는 문자열을 반환하는 이유는 무엇입니까?
이 XMLHttpRequest의에서 돌아 오는 것입니다 :
{__ob__:Observer, token: "123456" }
try console.log (response.data); –
ReferenceError : 변수를 찾을 수 없습니다. 응답 – JCraine