gpt4 book ai didi

ionic-framework - ionic - 错误 : Uncaught (in promise): removeView was not found

转载 作者:行者123 更新时间:2023-12-03 10:18:05 24 4
gpt4 key购买 nike

我的 Ionic 应用程序运行良好,但我没有对它做任何事情,但突然我收到此错误,我不知道为什么。

"Error: Uncaught (in promise): removeView was not found

最佳答案

当您想手动关闭 Ionic 加载时,您可能需要按照以下示例进行操作。我已经在 ionic 实验室测试过,这很好用。

Ionic 3+

注:
如果您手动调用 this.loading.dismiss(),我不建议使用dismissOnPageChange,您可能会两次关闭相同的加载。

为什么下面的解决方案有效?

我想 this.loading.present()是一个异步方法,所以我们不能调用 this.loading.dismiss()手动时 this.loading.present()仍在运行。

因此,如果我们需要手动关闭,我们需要确保加载已经存在并希望关闭它,我们应该在 present().then 之后使用其他方法。像下面的代码。

但是我不确定为什么我们在旧框架版本(2.0.3)中没有这个问题。
import { Loading, LoadingController } from 'ionic-angular';

export class ApnSearchPage {
loading: Loading;
constructor(private loadingCtrl: LoadingController) { }

ionViewDidLoad() {
this.createLoader();
}

createLoader(message: string = "Please wait...") { // Optional Parameter
this.loading = this.loadingCtrl.create({
content: message
});
}

public searchClick() {
this.createLoader();
this.loading.present().then(() => {
this.searchService.submitRequest(params, data)
.subscribe(response => {
this.loading.dismiss();
}, error => {
this.loading.dismiss();
this.errorMessage = <any>error
});
});
}
}

Reference Link ,因此仅发布有用和有效的提示和代码。

我希望这有帮助!

关于ionic-framework - ionic - 错误 : Uncaught (in promise): removeView was not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43828359/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com