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
demo内初次渲染时获取html元素宽高为0
dumi使用该主题,然后添加demo代码,并在初次渲染时获取html元素Rect,获取的都是无效Rect,目前需要延时才能正常获取。
在移除该主题后是正常的。
初次渲染时获取html元素正常的Rect。
dumi demo 代码
import React, { useEffect, useRef } from 'react'; const App: React.FC = () => { const ref = useRef<HTMLDivElement>(null); useEffect(() => { const el = ref.current; if (!el) return; // 使用dumi-theme-antd-style主题时获取的都是0,去掉主题后是正常的 console.log(el.getBoundingClientRect()); // 延时获取的是正常的 setTimeout(() => console.log(el.getBoundingClientRect()), 1000); }, []); return <div ref={ref}>test</div>; }; export default App;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
🐛 bug 描述
demo内初次渲染时获取html元素宽高为0
📷 复现步骤
dumi使用该主题,然后添加demo代码,并在初次渲染时获取html元素Rect,获取的都是无效Rect,目前需要延时才能正常获取。
在移除该主题后是正常的。
🏞 期望结果
初次渲染时获取html元素正常的Rect。
💻 复现代码
dumi demo 代码
© 版本信息
🚑 其他信息
The text was updated successfully, but these errors were encountered: