jqh hace 4 años
padre
commit
3e324cb9bd
Se han modificado 1 ficheros con 21 adiciones y 2 borrados
  1. 21 2
      src/Widgets/Modal.php

+ 21 - 2
src/Widgets/Modal.php

@@ -44,6 +44,11 @@ class Modal extends Widget
      */
     protected $events = [];
 
+    /**
+     * @var int
+     */
+    protected $delay = 10;
+
     /**
      * Modal constructor.
      *
@@ -115,6 +120,20 @@ class Modal extends Widget
         return $this->size('xl');
     }
 
+    /**
+     * 设置loading效果延迟时间.
+     *
+     * @param int $delay
+     *
+     * @return $this
+     */
+    public function delay(int $delay)
+    {
+        $this->delay = $delay;
+
+        return $this;
+    }
+
     /**
      * 设置按钮.
      *
@@ -265,9 +284,9 @@ setTimeout(function () {
     Dcat.helpers.asyncRender('{$url}', function (html) {
         modal.html(html);
     });
-}, 100);
+}, {$this->delay});
 JS
-);
+        );
     }
 
     public function render()