Commit ded7f026 authored by coderTomato's avatar coderTomato

解决sql编辑器因浏览器宽高改变而消失的问题

parent ee851376
...@@ -21,11 +21,14 @@ type StudioProps = { ...@@ -21,11 +21,14 @@ type StudioProps = {
rightClickMenu: StateType['rightClickMenu']; rightClickMenu: StateType['rightClickMenu'];
dispatch: any; dispatch: any;
}; };
const elementwidth = document.documentElement.clientWidth;
const elementHeight = document.documentElement.clientHeight;
const Studio: React.FC<StudioProps> = (props) => { const Studio: React.FC<StudioProps> = (props) => {
const {rightClickMenu, toolHeight, toolLeftWidth,toolRightWidth, dispatch} = props; const {rightClickMenu, toolHeight, toolLeftWidth,toolRightWidth, dispatch} = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const VIEW = { const VIEW = {
leftToolWidth: 300, leftToolWidth: 300,
marginTop: 116, marginTop: 116,
...@@ -36,13 +39,13 @@ const Studio: React.FC<StudioProps> = (props) => { ...@@ -36,13 +39,13 @@ const Studio: React.FC<StudioProps> = (props) => {
midMargin: 46, midMargin: 46,
}; };
const [size, setSize] = useState({ const [size, setSize] = useState({
width: document.documentElement.clientWidth - 1, width: elementwidth - 1,
height: document.documentElement.clientHeight, height: elementHeight,
}); });
const onResize = useCallback(() => { const onResize = useCallback(() => {
setSize({ setSize({
width: document.documentElement.clientWidth - 1, width: elementwidth - 1,
height: document.documentElement.clientHeight, height: elementHeight,
}) })
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment