Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location报错
解决 Vue 路由传递参数时,出现 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题.报错内容:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/sear
·
- 解决 Vue 路由传递参数时,出现 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题 .
- 报错内容:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/search/111".
- 问题描述:重复点击导航时,控制台报错
浏览器报错截图:
解决方法:src/router/index.js 配置文件中添加以下代码
// src/router/index.js
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
//添加以下代码
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
更多推荐
已为社区贡献2条内容
所有评论(0)