From 2fc7d766223210266e34985a6d4a83f0e1fe59a2 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 17 Mar 2022 15:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Tabs=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Tabs.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/Tabs.js b/components/Tabs.js index 56a44478..a6a9b1d9 100644 --- a/components/Tabs.js +++ b/components/Tabs.js @@ -10,13 +10,19 @@ const Tabs = ({ className, children }) => { return <> } - let count = children.length + children = children.filter(c => c !== '') + + let count = 0 children.forEach(e => { - if (!e) { - count-- + if (e) { + count++ } }) + if (count === 0) { + return <> + } + if (count === 1) { return
{children}