ue项目:IE11中地址栏直接改变路由页面不跳转bug,或通过a标签点击跳转,路由地址变化但页面无反应;

在app.vue 的 mounted 生命周期中写入下面的代码 :

if (!!window.ActiveXObject || 'ActiveXObject' in window) {
      window.addEventListener('hashchange', () => {
        let currentPath = window.location.hash.slice(1)
        if (this.$route.path !== currentPath) {
          this.$router.push(currentPath)// 主动更改路由界面
        }
      }, false)
    }

 

posted @ 2020-09-04 14:37  ____chen  阅读(487)  评论(0编辑  收藏  举报