【发布时间】:2017-03-31 03:45:52
【问题描述】:
我正在使用 Laravel 和 Vue.js 创建一个应用程序,最初我的应用程序运行良好,在创建了另一个组件后,它遵循与其他组件相同的过程,数据停止显示在表中,我开始
fetchUser: function(page) {
var _this2 = this;
this.$http.get('http://localhost:8000/api/v1/users?page='+page).then((response) => {
_this2.$set('users', response.data.data);
_this2.$set('pagination', response.data);
}, (response) => {
console.log("Ocorreu um erro na operação");
});
},
得到以下错误“main.js: 21678 Uncaught (in promise) TypeError: Can not read property 'data' of null”,其中一切都表明它在 main.js 文件中的第 21678 行。如果有人知道是什么发生请帮助我。接下来我介绍导致错误的函数的代码。
当我运行“console.log (response)”时,结果如下图所示: console.log(response)
请帮助我,因为我想继续使用 Laravel 和 Vue.js 进行动态处理。
【问题讨论】:
-
响应数据作为正文返回,而不是作为数据返回。你能显示生成数据的后端代码吗?
标签: javascript php laravel vue.js