Vue route jumps to the same page and reports an error many times. Navigationduplicated
The error report does not affect the program operation, but it is annoying to be popular. It needs to be solved.
the reason for the error report is this$ router. Push returns promise
just like
function push(){
return new Promise((resolve,reject)=>{
})
}
Solution 1: capture success value and error value (treat symptoms but not root causes)
this.$router.push({
name: "project",
params: { projectPattern: this.projectPattern },
},()=>{},()=>{ });
Solution 2: Rewrite push
and use it the same as before
this.$router.push({
name: "project",
params: { projectPattern: this.projectPattern },
});
In router/index JS file, write a process by judging whether there are resolve and reject incoming values
let originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location, resolve, reject) {
if (resolve && reject) {
originPush.call(this,location,resolve,reject)
}else{
originPush.call(this,location,()=>{},()=>{})
}
}```
Read More:
- [Solved] Vue console error: navigationduplicated: avoided redundant navigation to current location
- Vue Error: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- How to Solve Vue route jump repeated clicks Error
- Solve the problem of repeatedly clicking the same route console in Vue to report an error
- Vue solves the problem of repeated click navigation route error
- Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to crrent location: “/home“
- Jest Vue $route error [How to Modify]
- VueUncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- How to open a page in a new window by Vue router
- Vue refreshes the current page (no flash screen will appear)
- Vue a page is mounted to send multiple requests at the same time, and the loading is processed uniformly
- [Solved] Vue Error: Avoided redundant navigation to current location:/xxxx
- Vue elementui: solution for error: avoided redundant navigation to current location: “/xxx”
- [Solved] vue-roter 4 Error: Error: Invalid route component/Uncaught (in promise) Error: Invalid route component
- [Solved] Vue Project Modify Page Error: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- Vue2.0: How to Use vue3 api to encapsulate Axios
- [Solved] vue3vite Error: Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
- How to React page to achieve entry and exit animation