Browse Source

重置 field width 为默认宽度

Edwin Xu 3 years ago
parent
commit
4296879210
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Form/Row.php

+ 3 - 3
src/Form/Row.php

@@ -96,7 +96,7 @@ class Row implements Renderable
      *
      * @var int
      */
-    protected $fieldWidth;
+    protected $fieldWidth = 12;
 
     /**
      * @var bool
@@ -204,11 +204,11 @@ class Row implements Renderable
         $field->horizontal($this->horizontal);
 
         $this->fields->push([
-            'width'   => $this->fieldWidth ?: $this->defaultFieldWidth,
+            'width'   => $this->fieldWidth,
             'element' => $field,
         ]);
 
-        unset($this->fieldWidth); // unset field width for next field
+        $this->fieldWidth = $this->defaultFieldWidth; // reset field width for next field
 
         return $field;
     }