From dada0575c3b020220699af2b851f8dca6c7b8fae Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 2 Feb 2023 14:17:45 +0800 Subject: [PATCH] =?UTF-8?q?tabs=20=E5=AE=BD=E5=BA=A6=E3=80=81=E5=8A=A8?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Tabs.js | 47 +++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/components/Tabs.js b/components/Tabs.js index 9057f20e..f86f0b70 100644 --- a/components/Tabs.js +++ b/components/Tabs.js @@ -27,34 +27,39 @@ const Tabs = ({ className, children }) => { if (count === 1) { return
- {children} -
+ {children} + } - function tabClickHandle (i) { + function tabClickHandle(i) { setCurrentTab(i) } return
- -
- {children.map((item, index) => { - return
- {currentTab === index && item} -
- })} +
    + {children.map((item, index) => { + return
  • { + tabClickHandle(index) + }}> + {item?.key} +
  • + })} +
+
+ {children.map((item, index) => { + return
+ {currentTab === index && item} +
+ })} +
-
} export default Tabs