Vue.js scroll to top of new page route after setTimeout
问题 I have a page transition that doesn't work nicely when the scroll to the top of a new route is instant. I'd like to wait 100ms before it automatically scrolls to the top. The following code doesn't end up scrolling at all. Is there a way to do this? export default new Router({ mode: 'history', routes: [ { path: '/', name: 'Home', component: Home } ], scrollBehavior (to, from, savedPosition) { setTimeout(() => { return { x: 0, y: 0 } }, 100); } }) 回答1: This is natively supported by Vue now,