Vue中a标签href无法跳转,如何解决?

2026-04-05 20:333阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计155个文字,预计阅读时间需要1分钟。

Vue中a标签href无法跳转,如何解决?

问题:使用vue-router在IE下的a标签里的路由不跳转,火狐、chrome工作正常。解决:在App.vue里增加判断IE浏览器的手动修复代码...export default { name: 'App', mounted() { function checkIE() { return 'ms-scr'; } }}

问题:

使用vue-router 在IE下 a标签里的路由不跳转,火狐,chrome工作正常。

Vue中a标签href无法跳转,如何解决?

解决:

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

标签:解决方式

本文共计155个文字,预计阅读时间需要1分钟。

Vue中a标签href无法跳转,如何解决?

问题:使用vue-router在IE下的a标签里的路由不跳转,火狐、chrome工作正常。解决:在App.vue里增加判断IE浏览器的手动修复代码...export default { name: 'App', mounted() { function checkIE() { return 'ms-scr'; } }}

问题:

使用vue-router 在IE下 a标签里的路由不跳转,火狐,chrome工作正常。

Vue中a标签href无法跳转,如何解决?

解决:

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

标签:解决方式