because lazy loading is used in the project, the hash code of the modified file will change after each re-build, causing the route to jump to the modified page will report the page file 404. So when the navigation guard executes next (), call back if an error occurs, refresh the page again, and update the hash code to the latest can solve the problem.
looked up the Vue-router document and found that there are two guard methods, next (error) and router.onError (callback).
but I added this code directly to the code, and it didn"t work.
how is the guard method of this Vue-router error callback used?
//
router.beforeEach((to, from, next) => {
next(error);
})
router.onError((callback)=>{
console.log(callback)
});