EnumTabsButtonCard 枚举型选项卡片
代码演示
Studio 风格
const data = [{label: '1',key: '1',disabled: true,},{label: '2',key: 'two',},{label: '3',key: '3',},{label: '4',key: '5',},{label: '5',key: '6',},{label: '6',key: '7',},];export default () => {const [activeKey, setActiveKey] = useState('7');return (<ListViewstyle={{ backgroundColor: '#f9f9f9', minHeight: 200 }}list={[{title: 'Classic',content: (<View><ClassicEnumTabsButtonCardactiveKey={activeKey}data={data}title="Classic"icon={TuyaRNSvgs.power}unit="step"onChange={key => setActiveKey(key)}/><ClassicEnumTabsButtonCardstyle={{ marginTop: 20 }}data={data}title="Custom theme"icon={TuyaRNSvgs.power}unit="step"valueFontColor="#ff6700"grooveBgColor="#000"activeTextColor="#fff"thumbBgColor="#ff6700"onChange={key => setActiveKey(key)}/></View>),},]}/>);};
API
ClassicEnumTabsButtonCard
| 属性名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| data | 数据源 | EnumItem[] | (必选) |
| activeKey | 当前选中的 key | string | -- |
| defaultActiveKey | 默认选中的key | string | -- |
| onChange | key改变的回调函数 | (key: string, data: EnumItem) => void | -- |
| iconIsImage | 图标是否为图片 | boolean | false |
| style | 最外层容器样式 | StyleProp | -- |
| contentStyle | 内容容器样式 | StyleProp | -- |
| titleStyle | 标题容器痒死 | StyleProp | -- |
| titleTextStyle | 标题文字样式 | StyleProp | -- |
| circleStyle | 滑动槽中小圆点的样式 | ViewStyle | -- |
| unit | 单位,值右边的文字 | string | -- |
| padding | 外层容器的内边距 [top, right, bottom, left] | number | -- |
| title | 标题 | string | -- |
| showTitle | 是否展示标题 | boolean | true |
| titleFontColor | 标题字体眼神 | string | -- |
| titleFontSize | 标题字体大小 | number | -- |
| titleFontWeight | 标题字重 | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
| valueFontColor | 参数字体颜色 | string | -- |
| valueFontSize | 参数字体大小 | number | -- |
| valueFontWeight | 参数的字重 | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
| backgroundColor | 组件背景颜色 | string | -- |
| radius | 组件圆角 | number | -- |
| grooveBgColor | 滑动槽背景颜色 | string | -- |
| grooveHeight | 滑动槽高度 | number | -- |
| thumbBgColor | 滑块背景颜色 | string | -- |
| thumbHeight | 滑块高度 | number | -- |
| activeTextColor | 当前选中项的字体颜色 | string | -- |
| activeTextFontSize | 当前选中项的字体大小 | number | -- |
| icon | 图标 svg path | string | -- |
| iconSize | 图标尺寸 | number | cx(24) |
| iconBgSize | 组件背景尺寸 | number | cx(50) |
| showIcon | 是否显示图标 | boolean | true |
| showIconBg | 是否显示图标背景 | boolean | true |
| iconColor | 图标颜色 | string | #fff |
| iconBgColor | 图标背景颜色 只能设置 rgb、rgba 或者 hex | BackgroundType | #158CFB |
| iconBgRadius | 图标背景圆角 | number | cx(50) |
| imageRadius | 图片圆角 | number | 0 |