Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.

简介: Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.


这个错误提示是Vue Router抛出的,意思是你尝试导航到当前路由,这会被视为冗余操作。


在代码中,可能是因为多次点击了同一个导航链接或按钮,或者使用编程方式进行了重复导航操作,从而导致了这个错误。请检查你的代码,并确保在进行导航操作时不会重复导航到相同的路由地址。



解决方案1:删除导航当前路由代码


解决方案2:如果你使用的是Vue Router 3.x版本,你可以通过在router/index.js文件中添加下面的代码来禁用重复导航报错


const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}


相关文章
|
4月前
|
JavaScript
Error loading saved preferences: ~/.vuerc may be corrupted or have syntax errors. Please fix/delete
Error loading saved preferences: ~/.vuerc may be corrupted or have syntax errors. Please fix/delete
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
120 0
|
关系型数据库 MySQL C++
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
177 0
|
计算机视觉
opencv出错:error: (-213:The function/feature is not implemented) Unknown/unsupported array type
opencv出错:error: (-213:The function/feature is not implemented) Unknown/unsupported array type
467 0
|
网络协议 关系型数据库 Linux
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
182 0
|
JavaScript 前端开发
Parsing error: x-invalid-end-tag vue/no-parsing-error的问题解决方法
这个问题一般出现在前端项目中,是一个常见的问题
1357 0
Parsing error: x-invalid-end-tag vue/no-parsing-error的问题解决方法
Unable to add window --token is not valid
Unable to add window --token is not valid