jqh 4 years ago
parent
commit
9f3296d14d
1 changed files with 12 additions and 7 deletions
  1. 12 7
      src/Widgets/Modal.php

+ 12 - 7
src/Widgets/Modal.php

@@ -80,27 +80,32 @@ class Modal extends Widget
 
         $this->class('modal fade');
     }
-	
-	
+
 	/**
 	 * 设置弹窗垂直居中.
+     *
+     * @param bool $value
 	 *
 	 * @return $this
 	 */
-    public function centered()
+    public function centered(bool $value = true)
     {
-    	$this->centered = 'modal-dialog-centered';
+        $this->centered = $value ? 'modal-dialog-centered' : '';
+
     	return $this;
     }
 	
 	/**
-	 * 设置弹窗内容滚动
+	 * 设置弹窗内容滚动.
+     *
+     * @param bool $value
 	 *
 	 * @return $this
 	 */
-    public function scrollable()
+    public function scrollable(bool $value = true)
 	{
-		$this->scrollable = 'modal-dialog-scrollable';
+		$this->scrollable = $value ? 'modal-dialog-scrollable' : '';
+
 		return $this;
 	}
     /**