我是靠谱客的博主 妩媚抽屉,这篇文章主要介绍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无法跳转的解决方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持靠谱客。

最后

以上就是妩媚抽屉最近收集整理的关于Vue 中 a标签上href无法跳转的解决方式的全部内容,更多相关Vue内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(1134)

评论列表共有 0 条评论

立即
投稿
返回
顶部