-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
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
【暂无法修复】iframe 无法保持状态 #97
Comments
related: alitajs/umi-plugin-keep-alive#31 |
iframe相关可以使用ReactDOM.createPortal瞬移,这个思路貌似可行呢?https://wuli-admin.gitee.io/react-antd-template/#/dashboard |
大佬,你发的这个示例项目有源码吗?想参考学习一下 |
|
现在有人解决了,吗 |
同求,iframe 会重新加载 |
根据大佬的思路,找到了一种方法 |
// 是否显示
const [isShow, setIsShow] = React.useState(true);
useActivate(() => {
setIsShow(true);
});
useUnactivate(() => {
setIsShow(false);
});
const node = ReactDOM.createPortal(
<iframe
src=''
style={{
height: iframeHeight,
width: '100%',
border: 'none',
display: isShow ? 'initial' : 'none'
}}
/>,
document.querySelector('#containerId'),
) |
对 iframe 标签进行的 dom 移位操作一律会引起刷新,但 keep-alive 功能必须进行 dom 移位
此问题暂未寻到修正方式,暂不修复,请使用者注意
The text was updated successfully, but these errors were encountered: