I have route like this:
{
path: '/kontakt',
redirect: '#contact',
component: index
},
and scrollBehavior:
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
}
if(!to.hash) {
return {
x: 0, y: 0
}
}
if(to.hash) {
return {
selector: to.hash
}
}
}
and IMO because I display my page 1 second after user actually enter it (I show logo for 1sec) above code doesn't scroll page to #contact
div when I enter /kontakt
route.
app.vue
<div v-show="timeGap">
<router-view />
</div>
here timeGap is changed to true after 1sec in setTimeout
method. How to fix so it scroll to #contact div after this timeout?