EnumCard 枚举型卡片

代码演示

Studio 风格

import { ClassicEnumCard } from 'tuya-panel-classic-kit';
const IMAGE =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg==';
const list = [
{
label: 'status1',
icon: TuyaRNSvgs.power,
key: '0',
disabled: true,
},
{
label: 'status2',
icon: TuyaRNSvgs.power,
key: '1',
},
{
label: 'status3',
icon: TuyaRNSvgs.power,
key: '2',
},
{
label: 'status4',
icon: TuyaRNSvgs.power,
key: '3',
},
{
label: 'status5',
icon: TuyaRNSvgs.power,
key: '4',
},
{
label: 'status6',
icon: TuyaRNSvgs.power,
key: '5',
},
];
const list1 = list.map(item => {
return {
...item,
isImage: true,
icon: IMAGE,
};
});
<ClassicEnumCard
width={290}
title="Title"
data={list}
// data={[]}
activeKey={activeKey1}
onActiveKeyChange={onActiveKeyChange}
/>
<ClassicEnumCard
padding={[20, 20, 20, 20]}
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list.slice(0, 4)}
defaultActiveKey="1"
showIconBg={false}
activeIconColor="#ff6700"
activeTextColor="#ff6700"
/>
<ClassicEnumCard
pageCount={3}
style={{ marginTop: 20 }}
data={list}
defaultActiveKey="1"
showIconBg={false}
activeIconColor="#ff6700"
activeTextColor="#ff6700"
/>

北欧风格

import { NordicEnumCard } from 'tuya-panel-nordic-kit';
<NordicEnumCard disabled title="Title" data={list} activeKey="0" />
<NordicEnumCard
disabled
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list1.slice(0, 4)}
defaultActiveKey="1"
/>

亚克力风格

<AcrylicEnumCard title="Title" data={list} activeKey="0" />
<AcrylicEnumCard
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list1.slice(0, 4)}
defaultActiveKey="1"
/>

API

ClassicEnumCard

属性名描述类型默认值
data数据源EnumItem[](必选)
pageCount每页有多少数据number4
onActiveKeyChangekey 改变回调(key: string) => void--
disabled是否禁用组件boolean--
padding外层容器的内边距number[]--
width组件的宽度number--
style外层容器样式StyleProp--
textStyle按钮文字样式StyleProp--
titleStyle卡片标题样式StyleProp--
titleContentStyle卡片标题容器样式StyleProp--
contentStyle内容容器样式StyleProp--
dotWrapperStyle轮播图小圆点样式StyleProp--
activeKey当前选中的keystring--
defaultActiveKey默认选中的keystring--
iconBgColor每项的背景颜色BackgroundType--
activeIconColor当前选中项的图标颜色string--
activeIconBgColor当前选中项背景颜色BackgroundType--
showText按钮文字是否展示boolean--
textColor按钮字体颜色string--
textFontSize按钮字体大小number--
textFontWeight按钮字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
activeTextColor当前选中项字体颜色string--
title卡片标题string--
showTitle卡片标题是否显示boolean--
titleFontSize开案标题字体大小number--
titleColor卡片标题字体颜色string--
titleFontWeight卡片标题字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
backgroundColor中午string--
radius组件圆角number--
dotSize圆点尺寸number--
dotColor圆点颜色string--
activeDotColor选中圆点的颜色string--
icon图标 svg pathstring--
iconSize图标尺寸numbercx(24)
iconBgSize组件背景尺寸numbercx(50)
showIcon是否显示图标booleantrue
showIconBg是否显示图标背景booleantrue
iconColor图标颜色string#fff
iconBgRadius图标背景圆角numbercx(50)
tuya07:31