【发布时间】:2018-06-23 09:11:53
【问题描述】:
在我的 Vuetify 应用程序中,我发送一个 GET 和服务器响应,如下所示:
然后在 axios 中,我尝试使用 response.data.Autorizado 捕获该值并且不捕获。但是如果我只使用response.data,则显示数据,但显然服务器返回了大量数据,我想分发数据。
这是我的 axios 方法:
CargarCuenta(){
this.$Progress.start();
axios.get("Cuenta/Cuenta?rfc="+this.selectCuentas, {
headers:{
Authorization : "Bearer "+localStorage.getItem("token")
}
}).then(response =>{
this.$Progress.finish();
console.log(response.data);
this.autorizado = response.data.Autorizado;
}).catch(error => {
this.$Progress.finish();
console.log(error.response);
this.snackbar = true;
this.textSnackbar = error.response.data.Message;
})
}
this.autorizado 位于 data() 返回中,在模板中我这样使用它:{{autorizado}}。
【问题讨论】:
标签: vue.js axios vuetify.js