Explorar el Código

修复tabs控件的defaultActive不生效的问题

xujunjie hace 1 año
padre
commit
776afd39b6
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/components/TabsContent/index.js

+ 3 - 1
src/components/TabsContent/index.js

@@ -17,7 +17,9 @@ const TabsContent = (props) => {
   }, [active, items]);
 
   useEffect(() => {
-    setActive(parentActive);
+    if (parentActive) {
+      setActive(parentActive);
+    }
   }, [parentActive]);
   return (
     <div>