diff --git a/frontend/src/pages/Deploy/Deployment/List/index.tsx b/frontend/src/pages/Deploy/Deployment/List/index.tsx index 953026e4..d8ab8203 100644 --- a/frontend/src/pages/Deploy/Deployment/List/index.tsx +++ b/frontend/src/pages/Deploy/Deployment/List/index.tsx @@ -21,6 +21,11 @@ const CodePreviewModal: React.FC<{ }> = ({open, onCancel, code, language = 'shell'}) => { const [isFullscreen, setIsFullscreen] = useState(false); + // 当模态框打开或关闭时重置全屏状态 + useEffect(() => { + setIsFullscreen(false); + }, [open]); + return ( } open={open} - onCancel={onCancel} + onCancel={() => { + onCancel(); + setIsFullscreen(false); + }} footer={null} width={isFullscreen ? "100%" : 800} styles={{