소스 검색

公共方法优化

yuwenjun1997 2 년 전
부모
커밋
bf2a3d65c6
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      src/main/resources/static/js/utils.js

+ 8 - 4
src/main/resources/static/js/utils.js

@@ -178,7 +178,6 @@ CAIMEI.Popup = function(params,confirmCallback, cancelCallback){
  * @auth zhjy
  */
 CAIMEI.Alert = function(content,confitmText,flg,callback){
-    document.body.style.overflow = 'hidden';
     $.confirm({
         boxWidth: (isPC?'300px':'70%'),
         title:'提示',
@@ -193,12 +192,17 @@ CAIMEI.Alert = function(content,confitmText,flg,callback){
                 text: confitmText,
                 btnClass: 'btn-confirm',
                 action:function () {
-                    document.body.style.overflow = 'auto';
                     if(flg){
                         callback();
                     }
                 }
-            }
+            },
+        },
+        onOpen(){
+            document.body.style.overflow = 'hidden';
+        },
+        onClose(){
+            document.body.style.overflow = 'auto';
         }
     });
 };
@@ -373,4 +377,4 @@ function debounce(func, wait = 200, immediate = false) {
         }
         return result
     }
-}
+}