Page doesn't scroll to top when switching between pages
-
I’m creating an Android app using Capacitor and Quasar. I have a weird issue when switching between pages from my sidebar. I want every page to start at the top. When I’m on a page and scroll down on it, and then switch to a different page, that page is shown scrolled down (not scrolled to the top as I’d expect). Why is this?
I have the following set up in my router “index.js” file and I’ve tried a bunch of answers I’ve found online and on StackOverflow which didn’t help:export default function (/* { store, ssrContext } */) { const Router = new VueRouter({ scrollBehavior: () => ({ x: 0, y: 0 }), routes, // Leave these as is and change from quasar.conf.js instead! // quasar.conf.js -> build -> vueRouterMode // quasar.conf.js -> build -> publicPath mode: process.env.VUE_ROUTER_MODE, base: process.env.VUE_ROUTER_BASE }) return Router }
It’s worth noting that this works fine on a web browser, but when I build using “quasar dev -m capacitor -T android” and install and run the APK on a physical device, the scrolling does not work as I expect it to. What can I try to fix this?
Thanks!