class App {
app: Application
constructor() {
this.app = new Application();
axios.get(…).then(res => {
this.app.currentUser = res.data.data; // currentUser?: UserModel
});
}
}
在then里面this.app.currentUser赋值成功,但是返回之后this.app.CurrentUser为undefined,什么情况?
class App {
app: Application
constructor() {
this.app = new Application();
axios.get(…).then(res => {
this.app.currentUser = res.data.data; // currentUser?: UserModel
});
}
}
在then里面this.app.currentUser赋值成功,但是返回之后this.app.CurrentUser为undefined,什么情况?