Vue-router: Handle scrollBehaviour with transitions

Created on 17 Mar 2017  ·  3Comments  ·  Source: vuejs/vue-router

from #1262

Vue.js / vue-router versions

2.1.2 / 2.1.1

Reproduction Link



http://jsfiddle.net/qw4hbgek/

Problem

Clicking on Home, then on post1 will not scroll down because of the transition

Feature request

We should at least provide a way of doing it userland in the docs. Ideally, scrollbehaviour should trigger once the new view is inserted into the dom

docs group[transition wrapped views]

Most helpful comment

I've had a go at this, check out this commit.

It could be improved, if there were away to obtain the transition duration from the route object for example.

Would love to get some thoughts/input @posva @Atinux @pi0 @yyx990803

All 3 comments

Would supporting a returned promise here be enough to support most cases where there is a transition etc?

I've had a go at this, check out this commit.

It could be improved, if there were away to obtain the transition duration from the route object for example.

Would love to get some thoughts/input @posva @Atinux @pi0 @yyx990803

I forgot to add this can be handled with https://github.com/posva/vue-router-view-transition

Was this page helpful?
0 / 5 - 0 ratings