Browse Source

Merge remote-tracking branch 'origin/2.0' into 2.0

jqh 4 years ago
parent
commit
29209050bf
1 changed files with 34 additions and 3 deletions
  1. 34 3
      src/Widgets/Modal.php

+ 34 - 3
src/Widgets/Modal.php

@@ -41,7 +41,16 @@ class Modal extends Widget
      * @var string
      */
     protected $size = '';
-
+	
+	/**
+	 * @var string
+	 */
+    protected $centered = '';
+	
+	/**
+	 * @var string
+	 */
+    protected $scrollable = '';
     /**
      * @var array
      */
@@ -71,7 +80,29 @@ class Modal extends Widget
 
         $this->class('modal fade');
     }
-
+	
+	
+	/**
+	 * 设置弹窗垂直居中.
+	 *
+	 * @return $this
+	 */
+    public function centered()
+    {
+    	$this->centered = 'modal-dialog-centered';
+    	return $this;
+    }
+	
+	/**
+	 * 设置弹窗内容滚动
+	 *
+	 * @return $this
+	 */
+    public function scrollable()
+	{
+		$this->scrollable = 'modal-dialog-scrollable';
+		return $this;
+	}
     /**
      * 设置弹窗尺寸.
      *
@@ -347,7 +378,7 @@ JS
     {
         return <<<HTML
 <div {$this->formatHtmlAttributes()} role="dialog">
-    <div class="modal-dialog modal-{$this->size}">
+    <div class="modal-dialog {$this->centered} {$this->scrollable} modal-{$this->size}">
         <div class="modal-content">
             <div class="modal-header">
                 <h4 class="modal-title">{$this->renderTitle()}</h4>