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

网络编程 发布日期:2024/9/22 浏览次数:1

正在浏览: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无法跳转的解决方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。