1. Desative a função de avanço e retrocesso
1. Em main.js, adicione monitoramento popstate
window.addEventListener('popstate', function() {
history.pushState(null, null, document.URL)
})
2. Em index.js do roteador
const router = new Router({
mode: 'hash',
routes,
scrollBehavior: () => {
history.pushState(null, null, document.URL)
}
})
Você também pode tentar colocá-lo no beforeEach/afterEach do roteador
router.afterEach((to, from) => {
history.pushState(null, null, location.protocol + '//' + location.host + '/#' + to.path)
})