Sometimes different page transitions are needed when clicking a link vs. clicking the back button.
Does this mean we can have transitions that go back and forth between pages in a single page app?
I would be happy to see that. Maybe we could eventually get to do something like this?
http://www.appcoda.com/wp-content/uploads/2015/03/vid08.gif
+1
I would love a way to specify to vue-router that transitions has to be done in reverse order
Is there any updated?
How about this feature now ?
Until this get's an official solution, the method I've settled for is setting a "depth" meta property for each route. Then when the route changes, check whether the new route depth is higher or lower than the previous. If it's higher, transition from right, if it's lower (going back) transition from left.
Not ideal and could be a nightmare to maintain, but get's the job done for simple implementations.
{
name: 'categories',
path: '/categories',
component: categories,
meta: { depth: 1 },
},
{
name: 'category',
path: '/categories/:category/',
component: category,
meta: { depth: 2 },
}
<transition :name="transitionDirection">
<router-view></router-view>
</transition>
md5-c536852c0f23604e907f91cd3a77bfa1
data() {
return {
transitionDirection: 'slide-left',
}
},
watch: {
'$route' (to, from) {
const toDepth = to.meta.depth
const fromDepth = from.meta.depth
this.transitionDirection = toDepth < fromDepth ? 'slide-right' : 'slide-left';
}
}
md5-c536852c0f23604e907f91cd3a77bfa1
.slide-left-enter,
.slide-right-leave-active {
transform: translate3d(100%, 0, 0);
opacity: 0;
}
.slide-right-enter,
.slide-left-leave-active {
transform: translate3d(-100%, 0, 0);
opacity: 0;
}
md5-027f316cfc1f05693c8c45be9599dc8c
watch: {
'$route' (to, from) {
const toDepth = to.path.split('/').length
const fromDepth = from.path.split('/').length
this.transitionDirection = toDepth < fromDepth ? 'slide-right' : 'slide-left'
}
}
Transitions are extremely clumsy when using the swipe back gesture on iOS because they fire after the user has already reached the destination.
Being able to disable transitions when a forward/back button or browser gesture is used would be _very_ helpful.
Transitions are extremely clumsy when using the swipe back gesture on iOS because they fire after the user has already reached the destination.
Being able to disable transitions when a forward/back button or browser gesture is used would be _very_ helpful.
Have you found a work-around? I'm really struggling with transitions and swipe back gestures on iOS.
Have you found a work-around? I'm really struggling with transitions and swipe back gestures on iOS.
I never found a workaround, just this issue
Most helpful comment
Until this get's an official solution, the method I've settled for is setting a "depth" meta property for each route. Then when the route changes, check whether the new route depth is higher or lower than the previous. If it's higher, transition from right, if it's lower (going back) transition from left.
Not ideal and could be a nightmare to maintain, but get's the job done for simple implementations.