Răsfoiți Sursa

关闭时清除滚动条属性

visuddhinanda 2 ani în urmă
părinte
comite
1911b60b26
1 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 8 2
      dashboard/src/components/term/TermModal.tsx

+ 8 - 2
dashboard/src/components/term/TermModal.tsx

@@ -27,19 +27,25 @@ const TermModalWidget = ({
 }: IWidget) => {
   const [isModalOpen, setIsModalOpen] = useState(false);
 
+  const modalClone = () => {
+    setIsModalOpen(false);
+    if (document.getElementsByTagName("body")[0].hasAttribute("style")) {
+      document.getElementsByTagName("body")[0].removeAttribute("style");
+    }
+  };
   const showModal = () => {
     setIsModalOpen(true);
   };
 
   const handleOk = () => {
-    setIsModalOpen(false);
+    modalClone();
     if (typeof onClose !== "undefined") {
       onClose();
     }
   };
 
   const handleCancel = () => {
-    setIsModalOpen(false);
+    modalClone();
     if (typeof onClose !== "undefined") {
       onClose();
     }