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);
}


相关文章
|
7月前
|
算法 C# C++
HALCON error #1201: Wrong type of control parameter: 1 in operator threshold
HALCON error #1201: Wrong type of control parameter: 1 in operator threshold
|
9月前
|
缓存 PHP
Composer 报错 Error while processing content unencoding: Unknown failure within ...
Composer 报错 Error while processing content unencoding: Unknown failure within ...
142 0
|
10月前
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 : ‘}‘
74 0
|
11月前
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
200 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
406 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 问题解决
147 0
|
Unix Linux 异构计算
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See /var/log/nv
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See /var/log/nv
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See  /var/log/nv
my Note debug - add to function
Created by Wang, Jerry, last modified on Feb 03, 2015
104 0
my Note debug - add to function