ionic-framework - 我的 ionic 4 应用程序在单击后退按钮时关闭了几天。现在它不工作
问题描述
我正在开发一个 ionic4 应用程序。注销后,我使用 this.navController.navigateRoot 方法重定向到登录页面。通过单击移动返回按钮来关闭应用程序,我使用了以下代码。之后它工作了几天,现在我必须发布这个应用程序的更新,如果点击移动后退按钮它没有关闭应用程序,而是重定向到上一个打开的屏幕。谁能帮我解决这个问题?离子版本:5.2.3 代码:
ionViewDidEnter() {
this.subscription = this.platform.backButton.subscribe(async () => {
navigator['app'].exitApp();
});
}
ionViewWillLeave() {
this.subscription.unsubscribe();
}
解决方案
试试这种方式删除
async ()
constructor(public myplatform: Platform)
{}
ionViewDidEnter()
{
this.backbButtonSubscription = this.myplatform.backButton.subscribe(()=>{
//handle whatever You want
});
}
ionViewWillLeave(){
this.backbButtonSubscription.unsubscribe();
}
希望这会帮助你链接
推荐阅读
- python - 将总值的百分比插入到熊猫的数据透视表中
- reactjs - 是什么意思
in '导出默认类 App 扩展组件 ' 当我使用 react-native 创建项目时 - database - 可序列化隔离级别的有效案例
- javascript - 使用 Redux 将 onChangeText 中的 TextInput 格式化为 React Native 中的美元金额
- c# - 如何将 DataTable 转换为 CustomDataTable?
- node.js - 如何使用节点 js 将 azure blob 存储中的文件下载到本地文件夹
- blockchain - 你能告诉我如何使用 InvokeScriptTransaction
- javascript - 每次连续构建时,Webpack 包的大小都会增加
- windows - 无法在 Windows 10 上成功安装 rust
- python - 如何将 .txt 文件的前 30 个字符添加到变量中?