用vue-axios和axios后App.vue中this.seller = response.data.data需要俩个.data才有相同效果,请看代码。
来源:

sooaa3597221
2016-12-09
if中也要多加个.data
是不是因为vue-axios将json数据多包了一层?(我的猜想)
(header.vue中class=“avatar”写错了请不要在意,233)
1回答
-
看了你的问题,顺便去 github 上瞅了一眼 axios(https://github.com/mzabriskie/axios) 的文档。
Response Schema
The response for a request contains the following information.
{ // `data` is the response that was provided by the server
data: {}, // `status` is the HTTP status code from the server response
status: 200, // `statusText` is the HTTP status message from the server response
statusText: 'OK', // `headers` the headers that the server responded with
headers: {}, // `config` is the config that was provided to `axios` for the request
config: {}
}还是很清楚的,多包了一层 data。
然后我又顺便看了一下 vue-axios 的实现,基本上毫无意义,建议直接用 axios 吧。
PS: 遇到问题先查文档的习惯会比较好喔00
相似问题