报错:EXCEPTION: Uncaught (in promise): false
ORIGINAL STACKTRACE:
Error: Uncaught (in promise): false
login() {
let loader = this.httpService.loading();
//发布登录成功消息,刷新首页信息
this.viewCtrl.onDidDismiss(() => {
this.events.publish("LOGIN_SUCCESS");
});
loader.present()
loader.dismiss();
return this.viewCtrl.dismiss();
}
编辑后:
login() {
let loader = this.httpService.loading();
//发布登录成功消息,刷新首页信息
this.viewCtrl.onDidDismiss(() => {
this.events.publish("LOGIN_SUCCESS");
});
loader.present()
.then(() => {
// 在 loading 控件显示后立即关闭
return loader.dismiss();
})
.then(() => {
// 在 loader 关闭后关闭视图控制器
return this.viewCtrl.dismiss();
})
.catch((error) => {
// 捕获任何错误,并在控制台中记录
console.log('An error occurred:', error);
});
}