浏览代码

bug修复

xaboy 1 年之前
父节点
当前提交
03b0d999af
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/Form.php

+ 5 - 2
src/Form.php

@@ -307,6 +307,9 @@ class Form
 
     protected function parseFormComponent($rule)
     {
+        if (is_string($rule)) {
+            return $rule;
+        }
         if (Util::isComponent($rule)) {
             $rule = $rule->build();
         } else {
@@ -317,8 +320,8 @@ class Form
             }
             if (isset($rule['control'])) {
                 foreach ($rule['control'] as $i => $child) {
-                    foreach ($child['rule'] as $k => $rule) {
-                        $child['rule'][$k] = Util::isComponent($rule) ? $rule->build() : $rule;
+                    foreach ($child['rule'] as $k => $item) {
+                        $child['rule'][$k] = Util::isComponent($item) ? $item->build() : $item;
                     }
                     $rule['control'][$i] = $child;
                 }