Browse Source

增加Layout\Row::noGutters方法

jqh 4 years ago
parent
commit
c8226661ee
1 changed files with 17 additions and 1 deletions
  1. 17 1
      src/Layout/Row.php

+ 17 - 1
src/Layout/Row.php

@@ -11,6 +11,8 @@ class Row implements Renderable
      */
     protected $columns = [];
 
+    protected $noGutters = false;
+
     /**
      * Row constructor.
      *
@@ -48,6 +50,18 @@ class Row implements Renderable
         $this->columns[] = $column;
     }
 
+    /**
+     * @param bool $value
+     *
+     * @return $this
+     */
+    public function noGutters(bool $value = true)
+    {
+        $this->noGutters = $value;
+
+        return $this;
+    }
+
     /**
      * Build row column.
      *
@@ -71,7 +85,9 @@ class Row implements Renderable
      */
     protected function startRow()
     {
-        return '<div class="row">';
+        $noGutters = $this->noGutters ? 'no-gutters' : '';
+
+        return "<div class=\"row {$noGutters}\">";
     }
 
     /**