【发布时间】:2020-02-25 23:00:44
【问题描述】:
我目前正在开发适用于 Windows 10 (UWP) 的 Ionic 4 应用程序 (Angular)。
我想隐藏箭头:
我尝试了这些解决方案,在我的 app.component 构造函数中使用 initializeApp() :How to hide/remove Ionic 4 Cordova Windows 10 app back button?
但没有任何效果,我也尝试在 ionViewDidEnter 和我的应用程序的第一页中使用,超时 5 秒。
加载所有内容后调用 Windows.core 的方法。我的 app.component.ts 通过选项卡路由到我的身份验证页面。
app.component.ts
constructor(
...
) {
this.initializeApp();
this.setLanguageSettings();
}
private async initializeApp() {
await this.platform.ready();
if (this.platform.is('cordova') && cordova.platformId === 'windows') {
setTimeout(() => this.hideWindowsTitleBackArrow(), 1000);
}
private hideWindowsTitleBackArrow(): void {
console.log('hiding-first');
try {
const w: any = window;
if (w.cordova.platformId === 'windows') {
const currentView = w.Windows.UI.Core.SystemNavigationManager.getForCurrentView();
currentView.AppViewBackButtonVisibility =
w.Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
}
} catch (error) {
console.error(`Error in hideWindowsTitleBackArrow: ${error}`);
}
}
离子信息:
ionic info
Ionic:
Ionic CLI : 5.4.6
Ionic Framework : @ionic/angular 4.11.8
@angular-devkit/build-angular : 0.10.7
@angular-devkit/schematics : 7.0.7
@angular/cli : 7.0.7
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : windows 7.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 11 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.9
System:
NodeJS : v10.15.3 (C:\Tools\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
【问题讨论】:
标签: angular cordova ionic-framework uwp ionic4