vue主应用,qiankun 子应用切换主应用样式错乱问题
const childRoute = ['/flinkdashboard', '/dolphinscheduler', '/datainsight' ] //子应用路径 const isChildRoute = (path) => childRoute.some(item => path.startsWith(item)); const rawAppendChild = HTMLHeadElement.prototype.appendChild; const rawAddEventListener = window.addEventListener; router.beforeEach((to, from, next) => { //如果当前路由是子项目,并且去的路由是父项目的,则还原这两个对象 if (isChildRoute(from.path) && !isChildRoute(to.path)) { HTMLHeadElement.prototype.appendChild = rawAppendChild; window.addEventListener = rawAddEventListener; } })
标签:isChildRoute,vue,const,qiankun,应用,path From: https://www.cnblogs.com/wangyongping/p/17355682.html