Vue.js 防止在IOS ION 5 Vue应用程序上刷回
我以前使用Ionic Angular在整个应用程序中使用过:Vue.js 防止在IOS ION 5 Vue应用程序上刷回,vue.js,ionic-framework,vue-router,Vue.js,Ionic Framework,Vue Router,我以前使用Ionic Angular在整个应用程序中使用过: IonicModule.forRoot({ swipeBackEnabled: false }) 或通过注入IonRouterOutlet来创建单个页面: this.routerOutlet.swipeGesture = true; 但是,如何在Ionic Vue应用程序上执行此操作 我使用以下选项禁用全局刷卡: app.use(IonicVue, {swipeBackEnabled: false}) 但是如果我在页面上导入Io
IonicModule.forRoot({ swipeBackEnabled: false })
或通过注入IonRouterOutlet来创建单个页面:
this.routerOutlet.swipeGesture = true;
但是,如何在Ionic Vue应用程序上执行此操作
我使用以下选项禁用全局刷卡:
app.use(IonicVue, {swipeBackEnabled: false})
但是如果我在页面上导入IonRouteOutlet,它就没有swipeGesture属性,我也不知道如何在单个页面上禁用此选项。您可以在应用程序中全局禁用swipeGesture,方法是添加
[swipeGesture]=“false”
到src
根目录下的App.vue
文件中的离子路由器出口
:
<template>
<ion-app>
<Header />
<ion-router-outlet [swipeGesture]="false" />
</ion-app>
</template>
仅限iOS:
我找到了一种可行但不美观的方法。首先,从@ionic/vue导入CreateSpirate函数
import { createGesture } from '@ionic/vue';
然后,必须在ionViewWillEnter中覆盖标准回扫手势
const gesture = createGesture({
el: document.getElementById('test'),
threshold: 0,
gestureName: 'goback-swipe',
gesturePriority: 40.5, // priority of swipe to go back is 40
onMove: ev => console.log(ev)
});
gesture.enable(true);
然后给离子页面对象一个ID并对其应用该手势
<ion-page id="test">
我很想知道这个问题的答案,威尔将通过几点来看看这个问题是否能得到答案。