使用 vue-router 编程式实现页面跳转

this.$router.replace({ path: '/pub' });

出现错误如下图

原因:vue-router 在 3.1 版本之后把 this.$router.replace() 方法改为了 Promise,没有回调函数时错误信息就会由全局显示

解决办法:

1、降低 vue-router 版本到 3.0.7 以下

npm i vue-router@3.0.7 -S

2、给 this.$router.replace() 方法添加回调

this.$router.replace({ path: '/pub' }).catch(() => { });

注:this.$router.push() 方法也存在同样问题,可以同样处理

vue-router Uncaught (in promise) NavigationDuplicated 错误的更多相关文章

  1. vue报错vue-router.esm.js?8c4f:2007 Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated"}

    今天在写vue项目配置好路由点击菜单时,突然在控制台报错. 错误信息如下: Uncaught (in promise) NavigationDuplicated {_name: "Navig ...

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

    在进行跳转的时候报错 app.js:87499 Uncaught (in promise) NavigationDuplicated?{_name: "NavigationDuplicate ...

  3. Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplicated"}的解决方法

    左侧菜单栏时,发现点击路由跳转相同地址 会有这个报错 Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplic ...

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

    参考资料:https://blog.csdn.net/zy21131437/article/details/99548983

  5. vue router 报错:NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated"}

    https://blog.csdn.net/weixin_43202608/article/details/98884620

  6. 重写Router.prototype.push后还报NavigationDuplicated错误的解决方法

      vue项目路由跳转时控制台出现NavigationDuplicated错误, message: "Navigating to current location (XXX) is not  ...

  7. Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误

    使用Vue-cli3.x开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chu ...

  8. patchUpload.vue?5e29:406 Uncaught (in promise) DOMException: Failed to execute 'readAsArrayBuffer' on 'FileReader': The object is already busy reading Blobs.

    patchUpload.vue?5e29:406 Uncaught (in promise) DOMException: Failed to execute 'readAsArrayBuffer' o ...

  9. Vue. 之 报错 Uncaught (in promise)

    Vue. 之 报错 Uncaught (in promise) 在点击同一个URL的时候,会报错如下: 解决方案: 在项目目录下运行 npm i vue-router@3.0 -S 即可.

随机推荐

  1. [转]UiPath: How to Capture a Mouse Event on Hover Menus?

    本文转自:https://www.uipath.com/kb-articles/how-to-capture-mouse-event-on-hover-menus he Knowledgebase a ...

  2. 【Gradle】Gradle插件

    Gradle插件 插件的作用 把插件应用到项目中,插件会扩展项目的功能,帮助在项目构建过程中做很多事情. 1.可以添加任务到项目中,帮助完成测试.编译.打包等. 2.可以添加依赖配置到项目中,可以通过 ...

  3. Attaching an entity of type 'xxx' failed because another entity of the same type already has the same primary key value.

    问题的详细描述: Attaching an entity of type 'xxxxx' failed because another entity of the same type already ...

  4. 修改uid gid 的起始范围

    UID_MAX 60000 # # Min/max values for automatic gid selection in groupadd # GID_MIN 500 GID_MAX 60000 ...

  5. 《数据挖掘导论》实验课——实验二、数据处理之Matplotlib

    实验二.数据处理之Matplotlib 一.实验目的 1. 了解matplotlib库的基本功能 2. 掌握matplotlib库的使用方法 二.实验工具: 1. Anaconda 2. Numpy, ...

  6. 【转载】C++:switch红色下划线,Error:控制传输跳过的实例化解决办法

    转载链接:https://blog.csdn.net/figoleon/article/details/50072029

  7. Bert镜像制作及flask生产环境模式启动

    一天搞定两大技术点,成就满满. 一,dockerfile FROM harbor.xxx.com.cn/3rd_part/tensorflow:1.14.0-gpu-py3-jupyter LABEL ...

  8. Java Web 学习(9) —— EL 与 JSTL

    EL 与 JSTL EL与JSTL的作用是为了减少JSP页面中的代码. EL EL(Expression Language):表达式语言 常用于取值 语法 EL 表达式以${开头,以}结束. 多个表达 ...

  9. css3中calc、vw、vh、vmin、vmax 属性的应用及兼容性详解

    一. calc()的使用什么是calc()? calc()从字面我们可以把他理解为一个函数function.其实calc是英文单词calculate(计算)的缩写,是css3的一个新增的功能,用来指定 ...

  10. ZEN、ELECTRA、ALBERT

    一.ZEN 目前,大多数中文预训练模型基本上沿用了英文模型的做法,聚焦于小颗粒度文本单元(字)的输入.然而,与英文相比,中文没有空格等明确的词语边界.这个特点使得很多文本表达中存在的交叉歧义也被带入了 ...