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


参考:

github大佬
---------------------
作者:lllo3o
来源:CSDN
原文:https://blog.csdn.net/lllo3o/article/details/79929458
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/u013253924/article/details/84029549