优化Tabs组件

This commit is contained in:
tangly1024
2022-03-17 15:37:40 +08:00
parent e4f31cc860
commit 2fc7d76622

View File

@@ -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 <section className={'duration-200 ' + className}>
{children}