created() {
var that=this
axios.get(‘http://jsonplaceholder.typicode.com/todos‘)
.then(function (res) {
// handle success
// console.log(res);
that.todos = res.data
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
},
}
VUE - 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property 'xxxx' of undefined 的解决办法