/**
Rewrite the push method of the route
Solve the problem of reporting an error when jumping on the same route
Add, when same route jump, trigger watch (string only, like “view?id=5″)
*/
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
if(typeof(location)==”string”){
var Separator = “&”;
if(location.indexOf(‘?’)==-1) { Separator=’?’; }
location = location + Separator + “random=” + Math.random();
}
return routerPush.call(this, location).catch(error=> error)
}
Rewrite the push method of the route
Solve the problem of reporting an error when jumping on the same route
Add, when same route jump, trigger watch (string only, like “view?id=5″)
*/
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
if(typeof(location)==”string”){
var Separator = “&”;
if(location.indexOf(‘?’)==-1) { Separator=’?’; }
location = location + Separator + “random=” + Math.random();
}
return routerPush.call(this, location).catch(error=> error)
}
Read More:
- [Solved] Vue3 Configuration routing error: Catch all routes (“*“) must now be defined using a param with a custom regexp.
- Full screen scrolling by Vue + Vue awesomeswiper
- How to open a page in a new window by Vue router
- Solve the problem of repeatedly clicking the same route console in Vue to report an error
- Method of identifying vite alias path by idea webstorm
- [Solved] Element form method resetfields() error: vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read properties of undefined (reading ‘indexOf’)
- Vue modifies the value passed by props error: Avoid mutating a prop directly since the value will be overwritten whenever the par
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- [Solved] Vue console error: navigationduplicated: avoided redundant navigation to current location
- How to Solve Vue route jump repeated clicks Error
- Vue solves the problem of repeated click navigation route error
- Vue elementui: solution for error: avoided redundant navigation to current location: “/xxx”
- [Solved] Vue Error: Avoided redundant navigation to current location:/xxxx
- [Solved] Vue route jumps to the same page many times error: Navigationduplicated
- Vue Error: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- [Solved] vue3vite Error: Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- Vue warn]: vue3 element Component emit Pass Event Error
- [Solved] Vue Error: Uncaught TypeError: Vue.createApp is not a function
- Vue2.0: How to Use vue3 api to encapsulate Axios