import {useEffect, useState} from "react"; import {Tabs, TabPane} from '@nutui/nutui-react-taro' const list = [ { title: '今天', id: 1 }, { title: '昨天', id: 2 }, { title: '过去7天', id: 3 }, { title: '过去30天', id: 4 } ] const Chart = () => { const [tapIndex, setTapIndex] = useState('0') const reload = () => { } useEffect(() => { reload() }, []) return ( <> { setTapIndex(paneKey) }} > { list?.map((item, index) => { return ( ) }) } { list?.map((item, index) => { console.log(item.title) return (
{ tapIndex != index ? null :
线状图
}
) }) } ) } export default Chart