这是我处理OTP提交的方法:
submitOTP() {
const loader = new LoadingIndicator();
loader.show({
message: 'Verifying your response...',
dimBackground: true,
userInteractionEnabled: false, // default true. Set false so that the touches will fall through it.
hideBezel: true, // default false, can hide the surrounding bezel
mode: Mode.Indeterminate, // see options below
});
this.$store
.dispatch('submitOTP', this.otp)
.then(stt => {
if (stt == 'signed up') {
this.$navigateTo(RegistrationForm, {clearHistory: true});
} else if (stt == 'signed in') {
this.$navigateTo(Home, {clearHistory: true});
}
loader.hide();
})
.catch(e => {
console.log(e);
loader.hide();
});
},
这里的问题是加载指示器被隐藏,并且在一秒钟之后才被加载,然后新页面被加载。我想知道我是否可以做这样的事情:
this.$navigateTo(Home, {clearHistory: true}).then(loader.hide())