vue解决iframe在ie中切换url不生效问题

// 判断浏览器是否为IE
const isIE = (
  /MSIE (d+.d+);/.test(navigator.userAgent) || ~navigator.userAgent.indexOf('Trident/')
)



mounted() {
    // 兼容ie iframe切换路由不生效
    if (isIE) {
      window.addEventListener(
        'hashchange',
        () => {
          var currentPath = window.location.hash.slice(1)
          if (this.$route.path !== currentPath) {
            this.$router.push(currentPath)
          }
        },
        false
      )
    }
  }

在main.js中添加

原文地址:https://www.cnblogs.com/hpx2020/p/14437549.html