Bläddra i källkod

修复表单字段disable方法设置false无效问题

jqh 4 år sedan
förälder
incheckning
47509ccb54
1 ändrade filer med 12 tillägg och 0 borttagningar
  1. 12 0
      src/Form/Field.php

+ 12 - 0
src/Form/Field.php

@@ -784,6 +784,12 @@ class Field implements Renderable
      */
     public function readOnly(bool $value = true)
     {
+        if (! $value) {
+            unset($this->attributes['readonly']);
+
+            return $this;
+        }
+
         return $this->attribute('readonly', $value);
     }
 
@@ -796,6 +802,12 @@ class Field implements Renderable
      */
     public function disable(bool $value = true)
     {
+        if (! $value) {
+            unset($this->attributes['disabled']);
+
+            return $this;
+        }
+
         return $this->attribute('disabled', $value);
     }