Vue 中 a标签上href无法跳转的解决方式

问题:

使用vue-router 在IE下 a标签里的路由不跳转,火狐,chrome工作正常。

解决:

在App.vue 里增加判断IE浏览器手动修复……

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)
  }
 }
}

以上这篇Vue 中 a标签上href无法跳转的解决方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持来客网。