1. Initialize the entry item, redirect to the login page after the login expires, and the routing error is reported
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
//Solve the situation that programmatic routing to the same address will report an error
const originalPush = VueRouter.prototype.push;
const originalReplace = VueRouter.prototype.replace;
//push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject)
return originalPush.call(this, location, onResolve, onReject);
return originalPush.call(this, location).catch(err => err);
};
//replace
VueRouter.prototype.replace = function push(location, onResolve, onReject) {
if (onResolve || onReject)
return originalReplace.call(this, location, onResolve, onReject);
return originalReplace.call(this, location).catch(err => err);
};
Read More:
- How to Solve Error: avoided redundant navigation to current location: “index/user”
- Vue: How to Solve Error uncaught (in promise) cancel
- ROS2 Navigation Run TurtleBot Simulator Error [Solved]
- Uncaught (in promise) Error: Delete success at __webpack_exports__.default 405 error
- vue VM682:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- Refresh 404 after packaging Vue project, uncaught syntax error: unexpected token <
- Vue ElementUI el-dropdown Error: Uncaught TypeError: Cannot read property ‘disabled‘ of null
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- Maven configuration error: JAVA_HOME not found in your environment
- The browser is compatible with IE11 “ReferenceError: ‘Promise’ is not defined” “ReferenceError: ‘Promise’ is not defined”
- How to Solve the jump error after Spring Security Login
- [Solved] spring boot security Start Error: ‘login.html?error‘ is not a valid redirect URL
- [Solved] iperf Analyze Error: unable to create a new stream: Invalid argument
- Clion new method shows undefined reference to solution
- C++ new types may not be defined in a return type Error?
- [Solved] Vue3 Error: export ‘createRouter‘ was not found in ‘vue-router‘
- How to Fix Node SASS Error in Vue + webpack project after nodejs upgrade
- Error in plot.new() : figure margins too large
- AN ERROR MESSAGE APPEARS WHEN TOMCAT DEPLOYS A NEW PROJECT: INVALID BYTE TAG IN CONSTANT POOL: 15