We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
基座开启沙箱后,子应用挂载在基座body中的el-dialog样式会丢失,目前重写了子应用的 document.body.appendChild,让dialog挂载到子应用的节点中。 现在的问题是我的项目中有保活多个子应用的需求,重写后的appendChild会导致其他子应用也挂载到重写的那个子应用中,导致其他子应用出现dialog消失的问题
let revocable = null; // document.body.appendChild代理对象 const originFn = document.body.appendChild.bind(document.body); // 储存appendChild方法,在卸载子应用时还原appendChild // 在mount中调用proxy(props),重写appendChild const proxy = ({ container }) => { console.log(document.body.appendChild); if (document.body.appendChild.__isProxy__) return; revocable = Proxy.revocable(document.body.appendChild, { apply(target, thisArg, [node]) { if (container) { container.appendChild(node); } else { target.call(thisArg, node); } } }); if (revocable.proxy) { document.body.appendChild = revocable.proxy; } document.body.appendChild.__isProxy__ = true; };
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
开启样式隔离后,样式就会只写到子应用自己的 scope 下,这个就是样式隔离的特性。这种情况下也需要组件库一起配合,比如 antd 下通过 ConfigProvider getPopupContainer 指定弹框渲染的范围
ConfigProvider getPopupContainer
你好 这个问题解决了吗
你好 这个问题解决了吗 默认弹窗范围document.body,按照上面的方法修改一下就解决了。
No branches or pull requests
问题描述:
基座开启沙箱后,子应用挂载在基座body中的el-dialog样式会丢失,目前重写了子应用的 document.body.appendChild,让dialog挂载到子应用的节点中。
现在的问题是我的项目中有保活多个子应用的需求,重写后的appendChild会导致其他子应用也挂载到重写的那个子应用中,导致其他子应用出现dialog消失的问题
关键代码:
环境
The text was updated successfully, but these errors were encountered: