使用axios
请求数据后在其内部调用this.setState({})
刷新UI时报[TypeError: undefined is not a function]
使用下面这个方法:
axios({
method: "get",
url: url,
})
.then((response) => {
let data = response.data;
let dic = data["object"];
this.setState({});
})
.catch(function(error) {
console.log(error);
});
网友评论