The solution to the href on the a tag in Vue cannot jump

created at 07-03-2021 views: 2

problem

Using vue-router, the routing in the a tag under IE does not redirect, Firefox and Chrome work normally.

solution

Add to App.vue to determine that IE browser is manually repaired...

export default {
 name: 'App',
 mounted(){
  function checkIE(){
   return '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style
  }
  if (checkIE()) {
   window.addEventListener('hashchange', () => {
    var currentPath = window.location.hash.slice(1);
    if (this.$route.path !== currentPath) {
    this.$router.push(currentPath)
   }
  }, false)
  }
 }
}

The solution to the inability to jump to the href on the a tag in the above Vue is all the content shared by the editor, I hope to give you a reference, and I hope you can support us a lot.

created at:07-03-2021
edited at: 07-03-2021: