fix(vue): use direction type from core (#17901)

This commit is contained in:
Michael Tintiuc
2019-04-08 21:59:09 +03:00
committed by Mike Hartington
parent d87170db3a
commit fa1317359a
3 changed files with 17 additions and 15 deletions

View File

@ -1,4 +1,5 @@
import Vue, { CreateElement, RenderContext, VNodeData } from 'vue';
import { NavDirection } from '@ionic/core';
type TransitionDone = () => void;
interface Props {
@ -69,7 +70,7 @@ function catchIonicGoBack(parent: Vue, event: Event): void {
let defaultHref: string;
// Explicitly override router direction to always trigger a back transition
$router.directionOverride = -1;
$router.directionOverride = 'back';
// If we can go back - do so
if ($router.canGoBack()) {
@ -127,8 +128,8 @@ function transition(parent: Vue, props: Props, leavingEl: HTMLElement) {
return ionRouterOutlet.componentOnReady().then((el: HTMLIonRouterOutletElement) => {
return el.commit(enteringEl, leavingEl, {
deepWait: true,
duration: !props.animated ? 0 : undefined,
direction: parent.$router.direction === 1 ? 'forward' : 'back',
duration: !props.animated || parent.$router.direction === 'root' ? 0 : undefined,
direction: parent.$router.direction as NavDirection,
showGoBack: parent.$router.canGoBack(),
});
}).catch(console.error);