Vue2.0-vue-router jump scroll bar returns to the top

configuring
router.afterEach ((to, from, next) = > {
window.scrollTo (0,0)
})
or index.js configuration
scrollBehavior (to, from, savedPosition) {
return {x: 0, y: 0}
}
in main.js has no effect, is there any other way? Ladies and gentlemen

Mar.21,2021

try this

router.afterEach((to, from, next) => {
    document.documentElement.scrollTop = 0
    document.body.scrollTop = 0
})

try adding a timer

router.afterEach((to, from, next) => {
 setTimeout(function() {
        window.scrollTo(0, 0)
    },100)
})

scrollBehavior (to, from, savedPosition) {

return { x: 0, y: 0 }

}

Menu