【问题标题】:How to remove UWP (Cordova) title bar arrow?如何删除 UWP (Cordova) 标题栏箭头?
【发布时间】:2018-03-03 13:00:27
【问题描述】:

我有一个在 Windows 10 (UWP) 上运行的 Cordova 应用程序,我正在使用 Visual Studio 2017 构建 Cordova 项目。

托管窗口的标题栏中有一个我要删除的箭头。

这是我正在谈论的图片:

我在 StackOverflow 上看到另一个问题,该问题的答案是使用以下代码:

if (cordova.platformId == "windows")
{
    var currentView = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
    currentView.appViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
}

但是,这对我不起作用。

我在 DeviceReady 之后执行检查,cordova.platformId 确实等于“windows”,这很好。

JavaScript 代码如何执行 Windows.UI.Core.SystemNavigationManger 命名空间?根据以下链接,我了解它是一个 UWP 命名空间, Windows.UI.Core.SystemNavigationManger,但是 JavaScript 代码在哪里定义和访问它?我是否缺少第 3 方 Cordova 插件?

【问题讨论】:

  • 查看官方代码:navigator.js
  • @Macer 你解决了吗?问题请帮帮我。

标签: javascript windows cordova uwp


【解决方案1】:

我遇到了同样的问题。我可以通过将以下代码放入我的第一个组件的渲染中来修复它:

if (window.cordova && window.cordova.platformId === "windows")
{
    console.log("Disabling back button")
    var currentView = window.Windows.UI.Core.SystemNavigationManager.getForCurrentView();
    currentView.appViewBackButtonVisibility = window.Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    相关资源
    最近更新 更多