如何在离子4角度项目中全局禁用滑动后退手势

问题描述 投票:3回答:1

已经尝试通过以下方式实现此目的:

<ion-router-outlet swipeGesture="false" animated="false"></ion-router-outlet>

在app.module中:

IonicModule.forRoot({
    swipeBackEnabled: false
}),

config.xml文件:

<preference name="AllowBackForwardNavigationGestures" value="false" />

..但水平滑动手势仍然触发导航到其他页面:-(

我可以想到并尝试部分但不成功的方法是:

  1. 以某种方式使用弃用的离子navController?
  2. 用锤子?
  3. 使用未记录的GestureController(https://github.com/ionic-team/ionic/tree/a77ee2a6f88e8defb1763b71e77410264fafac70/core/src/utils/gesture

如果有人能指出正确的方向或提供一个如何禁用刷卡的例子,主要是针对iOS,我会很高兴,很多

ios angular ionic-framework gesture ionic4
1个回答
6
投票

我通过将[swipeGesture]="false"添加到ion-router-outlet来解决它,如下所述:https://github.com/ionic-team/ionic/issues/16441

起初,我错误地将它添加到我的ion-router-outlet文件中的所有tabs.htmls。那没用。相反,您只需将其添加到ion-router-outlet文件中的app.component.html。这对我有用。

app.component.html

<ion-app>
  <ion-router-outlet [swipeGesture]="false"></ion-router-outlet>
</ion-app>

我正在使用离子版4.0.0-beta.17

© www.soinside.com 2019 - 2024. All rights reserved.