Vue Navigating to current location (“XXXXXX“) is not allowed

编程入门 行业动态 更新时间:2024-10-15 16:25:52

Vue Navigating to <a href=https://www.elefans.com/category/jswz/34/1739388.html style=current location (“XXXXXX“) is not allowed"/>

Vue Navigating to current location (“XXXXXX“) is not allowed

问题:

在VUE项目中点击两次路由切换

 原因:

在路由跳转的时候同一个路由多次添加是不被允许的

 解决方案(两种):

1.切换版本回3.0版本

2.在你引了 vue-router 的 js文件里加上如下代码即可

import Vue from 'vue'  //如果已引用,不需要重复引用
import Router from 'vue-router'; //如果已引用,不需要重复引用
Vue.use(Router) //如果已引用,不需要重复引用
const VueRouterPush = Router.prototype.push 
Router.prototype.push = function push (to) {return VueRouterPush.call(this, to).catch(err => err)
}

 

 

 

 

更多推荐

Vue Navigating to current location (“XXXXXX“) is not allowed

本文发布于:2024-02-27 10:48:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1706250.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:current   Navigating   Vue   allowed   XXXXXX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!