Closed Frankwarnaar closed 5 years ago
@Frankwarnaar
It is actually a problem with vue-router
when it boots twice with mode history
.
Thank you for your quick response! Putting mode: hash
in my nuxt config and then using mode: history
when creating my custom router seems to be a workaround indeed.
Yes, it's an alternative.
I'll see with the team nuxt to instantiate just once the vue-router
Great! It seems to be the case that I was a bit over enthusiastic. In development the described workaround did work, but when running nuxt generate
, no routes were generated anymore.
@Frankwarnaar see v1.5.0
add new parameter routerOptions
https://github.com/nuxt-community/router-module#accessing-default-router
Version
v1.4.0
Reproduction link
https://github.com/Frankwarnaar/nuxt-router-scrollposition-issue-demo
Steps to reproduce
Navigate to https://quizzical-villani-0e65e2.netlify.com (a deploy of the repo I provided). Scroll a bit down and then click the
Other page
link. Then click browser back.What is expected ?
The scroll position should be the same as before leaving the page.
What is actually happening?
The scroll position is reset.
Additional comments
I'm running with the
keepDefaultRouter
option set to true. My router can be found insrc/router.js
. I've been trying to debug the issue, by providing ascrollPosition
function to my router. Somehow thesavedPosition
argument was always{ x: 0, y: 0 }
, .