Vue deshabilita el navegador hacia adelante y hacia atrás

1. En main.js, agregue la supervisión de popstate

window.addEventListener('popstate', function() {
    history.pushState(null, null, document.URL)
})

2. Index.js del enrutador:

const router = new Router({
 mode: 'hash',
 routes,
 scrollBehavior: () => {
  history.pushState(null, null, document.URL)
 }
})

 

Supongo que te gusta

Origin blog.csdn.net/weixin_42217154/article/details/109776249
Recomendado
Clasificación