diff --git a/src/layouts/index.less b/src/layouts/index.less index c6b3735c..77dbd449 100644 --- a/src/layouts/index.less +++ b/src/layouts/index.less @@ -51,8 +51,7 @@ body { overflow: auto; .ant-pro-page-container-children-content { overflow: auto; - height: calc(100vh - 96px); - height: calc(100vh - var(--vh-offset, 0px) - 96px); + height: 100%; background-color: #fff; padding: 16px; } @@ -77,7 +76,7 @@ body { .log-wrapper { .log-select { - width: 300px; + width: 250px; } .ant-page-header-heading-left { min-width: 100px; @@ -140,7 +139,6 @@ input:-webkit-autofill:active { flex: 1; .ant-pro-grid-content-children { height: calc(100% - 48px); - height: calc(100% - var(--vh-offset, 0px) - 48px); > div, .log-container, .react-codemirror2, @@ -152,22 +150,11 @@ input:-webkit-autofill:active { } @media (max-width: 768px) { - .ant-pro-grid-content.wide { - .ant-pro-page-container-children-content { - height: calc(100vh - 144px); - height: calc(100vh - var(--vh-offset, 0px) - 144px); - } - } - .ql-container-wrapper { &.crontab-wrapper, &.log-wrapper, &.env-wrapper, &.config-wrapper { - .ant-pro-grid-content.wide .ant-pro-page-container-children-content { - height: calc(100vh - 184px); - height: calc(100vh - var(--vh-offset, 0px) - 184px); - } .CodeMirror { width: calc(100vw - 80px); } diff --git a/src/pages/log/index.tsx b/src/pages/log/index.tsx index 2d7a096b..c6038307 100644 --- a/src/pages/log/index.tsx +++ b/src/pages/log/index.tsx @@ -105,7 +105,9 @@ const Log = ({ headerStyle, isPhone, theme }: any) => { useEffect(() => { getLogs(); - setHeight(treeDom.current.clientHeight); + if (treeDom && treeDom.current) { + setHeight(treeDom.current.clientHeight); + } }, []); return ( diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx index f71b3b58..71e699eb 100644 --- a/src/pages/script/index.tsx +++ b/src/pages/script/index.tsx @@ -192,7 +192,9 @@ const Script = ({ headerStyle, isPhone, theme }: any) => { useEffect(() => { getScripts(); - setHeight(treeDom.current.clientHeight); + if (treeDom && treeDom.current) { + setHeight(treeDom.current.clientHeight); + } }, []); return ( diff --git a/src/utils/hooks.ts b/src/utils/hooks.ts index 6c51f343..c3094c11 100644 --- a/src/utils/hooks.ts +++ b/src/utils/hooks.ts @@ -9,7 +9,7 @@ export const useCtx = () => { const { platform } = useMemo(() => browserType(), []); useEffect(() => { - if (platform === 'mobile' || document.body.offsetWidth < 768) { + if (platform === 'mobile' && document.body.offsetWidth < 768) { setWidth('auto'); setMarginLeft(0); setMarginTop(0);