Nativescript-vue 原生 iOS 在 ActionBar 上设置标题后导航按钮消失

Nativescript-vue native iOS Navigation button disappears after setting title on ActionBar

当我只使用普通的 ActionBar 时:

<ActionBar/>

当我改变路线时:

this.$navigateTo(Catalog)

原生ios后退按钮正常出现, 但是当我像这样更改 action-bar 时:

<ActionBar title="some title"/>

或者像这样将其他元素放入 action-bar 中:

<ActionBar>
    <NavigationButton text="Go back" android.systemIcon="ic_menu_back" @tap="goBack" />
<ActionBar/>

默认原生 ios 后退按钮消失。

我最终需要的是带有自定义标题的默认 ios action-bar 和当我在组件之间导航时出现的原生 ios 后退按钮。请帮助,提前致谢!

我无法在我这边重现该问题,当我使用上面的确切代码片段时,NavigationButton 仍然可见,并使用 iOS v12.1.4 进行了测试。如果您仍然遇到问题,请分享 Playground 示例。

但是,您将无法修改 iOS 上的点击处理程序,如 docs 中所述。

In iOS, the back button is used explicitly for navigation. It navigates to the previous page and you cannot handle the tap event to override this behavior.

If you want to place a button on the left side of the ActionBar and handle the tap event (e.g., show slide-out), you can use ActionItem with ios.position="left".

解决了我的问题。我在我的主要组件中使用 ActionBar(其中定义了选项卡)。相反,我将它从我的主要组件中删除,并为每个组件添加了自己的 ActionBar。那解决了问题。现在,默认的 ios 后退按钮可以正确显示任何其他参数或嵌套元素的组合,无论您是否路由到相同组件的框架都没有关系。