vue router 报错: Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解决方法

今天在写vue-music的时候,发现每次跳转路由都会出现这个错误,于是上网查了一下解决的方法

在main.js中添加

import Router from ‘vue-router‘

const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {

return originalPush.call(this, location).catch(err => err)

}

原文地址:https://www.cnblogs.com/guozhiqiang/p/12343987.html

时间: 2024-07-29 08:22:37

vue router 报错: Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解决方法的相关文章

Vue ElementUI Axios报错: Uncaught (in promise) TypeError: Cannot read property '$message' of undefined

从头再来!!! 出错的代码如下: login() { this.loading = true let userInfo = {account: this.loginForm.account, password: this.loginForm.password, captcha: this.loginForm.chptcha} this.$api.login.login(userInfo).then( function(res) { if (res.msg != null) { this.$mes

报错:Could not launch 'app name',解决方法

如果你也出現了“Could not launch 'app name'”,No such file or directory (/Users/apple/Library/Developer/Xcode/DerivedData/mytest-ejkagqxooxgmtdfsdoygtyzflibe/Build/Products/Debug-iphoneos/mytest.app/mytest) 这样的讯息的話,有几个处理方法1.刪除DerivedData資料夾法1.1 完全离开Xcode,然后再做

python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdefaultencoding('utf-8') AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法: 1.python2中解决方法:reload(sys)sys.setdefaultencoding('utf-8'

python 编码报错问题 'ascii' codec can't encode characters 解决方法

python在安装时,默认的编码是ascii, 当程序中出现非ascii编码时,python的处理常常会报这样的错 'ascii' codec can't encode characters python没办法处理非ascii编码的, 此时需要自己设置将python的默认编码,一般设置为utf8的编码格式. 查看python的默认编码 print sys.getdefaultencoding() 解决方法一(已通过验证,顺带也解决了我之前字符前一直加u的问题) 在python安装目录下,进入\P

Centos6 下启动httpd报错 Could not reliably determine the server's解决方法

在启动httpd的时候报错: 修改/etc/httpd/conf/httpd.conf 配置,去掉ServerName 前的#(或者手动添加ServerName localhost:80)然后重启httpd服务: Centos6 下启动httpd报错 Could not reliably determine the server's解决方法

keil 通过JTAG下载程序 报错:error: flash download failed - "cortex-m3"的解决方法

硬件环境: nxp lpc1788fbd208核心板 软件环境: keil uvision4 segger j-flash arm v4.50 其他: 芯片选择正确 jtag模式 现象:之前用JFlashARM.exe下载了程序,在没有擦除程序的情况下,JTAG模式下用keil下载程序 报错 error: flash download failed - "cortex-m3" 原因:用jFlashARM.exe下载程序后,没有擦除程序 解决:擦除lpc1788 上的程序,然后在keil

很爽的一点。用Mysql5.x以上版本出现报错#1929 Incorrect datetime value: '' for column 'createtime' 解决方法

我的mysql安装后,保存删除表数据总是出现#1929 Incorrect datetime value: '' for column 'createtime' 的报错提醒,导致不能删除表里数据: 原因: 5以上的版本如果时期时间是空值应该要写NULL: 官方解释说:得知新版本mysql对空值插入有"bug", 要在安装mysql的时候去除默认勾选的enable strict SQL mode 那么如果我们安装好了mysql怎么办了,解决办法是更改mysql中的配置 my.ini 解决

在WSL中安装swool报错 error: unrecognized command line option '-V' 的解决方法

Windows Subsystem for Linux Ubuntu中使用pecl安装swool时遇到错误"error: C compiler cannot create executables"."error: unrecognized command line option '-V'" 解决方法 先看解决方法, 将gcc版本降低到4.8即可,因为高版本gcc取消了-V参数: sudo apt install gcc-4.8 -y sudo update-alte

vue-router点击菜单栏同一个模块报错 ———— Uncaught(in promise) NavigationDuplicated error .......

在做移动端底部导航时,鼠标双击各个选项会报如下错误,但是单击时不会出现任何问题. 出现这个bug的原因就是vue-router版本问题,vue-router 3.0版本以上的回调形式是promise api的形式,返回的是一个promise,如果没有捕获到错误,控制台始终会出现上图的警告: 解决方法之可以是安装低版本的vue-router或者捕获抛出放入错误: 解决方法大概包括以下3种解决方法: 1)删除node_modules文件夹,然后使用“cnpm install”重新安装依赖(ps:尝试

maven, install 时候报错“编码 gbk 的不可映射字符”的解决方法

myeclipse maven, install 时候报错"编码 gbk 的不可映射字符" 报错的原因是compiler采用了GBK编码,而源代码设置的是utf8编码导致编译的时候无法正确解析源码,解决方法很简单,在pom的compiler插件配置处加入<encoding>utf8</encoding> 即可,如下: <build>        <plugins>            <plugin>