Sfoglia il codice sorgente

修复当Login内不使用Tab时,输入框无法输入的问题 (#794)

* 修复当Login内不使用Tab无法输入当问题

当Login内不使用Tab时,存在二个问题:
1、item有可能为空
2、输入框无法输入,执行了Login的render方法,但子组件没有执行

* 修复当用tab时子元素被清空当问题

修复当用tab时子元素被清空当问题
lyingd 8 anni fa
parent
commit
2d36097c7c
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      src/components/Login/index.js

+ 4 - 1
src/components/Login/index.js

@@ -81,6 +81,9 @@ class Login extends Component {
     const TabChildren = [];
     const TabChildren = [];
     const otherChildren = [];
     const otherChildren = [];
     React.Children.forEach(children, (item) => {
     React.Children.forEach(children, (item) => {
+      if (!item) {
+        return;
+      }
       // eslint-disable-next-line
       // eslint-disable-next-line
       if (item.type.__ANT_PRO_LOGIN_TAB) {
       if (item.type.__ANT_PRO_LOGIN_TAB) {
         TabChildren.push(item);
         TabChildren.push(item);
@@ -104,7 +107,7 @@ class Login extends Component {
                 </Tabs>
                 </Tabs>
                 {otherChildren}
                 {otherChildren}
               </div>
               </div>
-            ) : children
+            ) : [...children]
           }
           }
         </Form>
         </Form>
       </div>
       </div>