/* * @Description: * @Author: jiass * @Date: 2022-01-25 13:29:21 * @LastEditTime: 2022-04-08 16:17:50 * @LastEditors: lanzhisheng */ import React, { FC, useState } from "react"; import { View } from "@tarojs/components"; interface propsType { data: []; onClick: any; defaultValue: number; } const TabsButton: FC = (props) => { const { data, onClick, defaultValue } = props; const [baseBtnType, setBaseBtnType] = useState(defaultValue || 1); const onClickBaseType = (type) => { setBaseBtnType(type); onClick(type); }; return ( {data.map((item: any) => ( { onClickBaseType(item?.id); }} > {item?.name} ))} ); }; export default TabsButton;