Keep-alive cache components, three-level menu components can not be cached to solve the problem

The third-level menu of the background management menu list cannot cache components. The root cause is the defect of keep-alive itself. It is necessary to optimize the matched attribute in the routing guard, as follows

Router.beforeEach((to, from, next)=>{
    
    
	if(to.matched && to.matched.length>2){
    
    
		to.matched.splice(1,to.matched.length -2)
	}
	next()
})

Add the above code on the routing hook to solve the keep-alive cache problem

Guess you like

Origin blog.csdn.net/weixin_47818125/article/details/126947593