EnumSliderCard 枚举型滑动条卡片
代码演示
亚克力风格
const data = [{label: 'close',key: '0',},{label: 'one',key: '1',},{label: 'two',key: '2',},{label: 'three',key: '3',},];export default () => {const [activeKey1, setActiveKey1] = useState('3');return (<ListViewstyle={{ backgroundColor: '#f9f9f9', minHeight: 200 }}list={[{title: 'Acrylic',content: (<View><AcrylicEnumSliderCarddata={data}title="AcrylicEnumSliderCard"icon={TuyaRNSvgs.power}bottomPromptTexts={['Off', 'Max']}activeKey={activeKey1}handSlidingComplete={(key, index) => setActiveKey1(key)}/><View style={{ marginTop: 20 }}><ButtononPress={() => setActiveKey1('2')}title="click to change key 2"/></View></View>),},]}/>);};
API
AcrylicEnumSliderCard
属性名 | 描述 | 类型 | 默认值 |
---|---|---|---|
data | 数据源 | EnumList[] | (必选) |
activeKey | 当前选中的key | string | -- |
handSlidingComplete | 值改变完成后回调 | (key: string, index: number) => void | -- |
handValueChange | 值改变回调 | (key: string, index: number) => void | -- |
sliderDotSize | 滚动条上小圆点尺寸 | number | -- |
sliderDotColor | 参数右边的小圆点颜色 | string | -- |
activeSliderDotColor | 参数左边的小圆点颜色 | string | -- |
style | 外层容器样式 | StyleProp | -- |
icon | 图标 svg path | string | -- |
iconSize | 图标尺寸 | number | cx(24) |
iconBgSize | 组件背景尺寸 | number | cx(50) |
showIconBg | 是否显示图标背景 | boolean | true |
iconColor | 图标颜色 | string | #fff |
iconBgColor | 图标背景颜色 只能设置 rgb、rgba 或者 hex | BackgroundType | #158CFB |
iconBgRadius | 图标背景圆角 | number | cx(50) |
sliderProps | Slider props 文档:https://panel-docs.tuyacn.com/docs/data-entry/slider | SliderProps | -- |
titleStyle | 标题容器样式 | StyleProp | -- |
titleTextStyle | 标题字体样式 | StyleProp | -- |
contentStyle | 内容容器样式 | StyleProp | -- |
thumbStyle | Slider滑块样式 | StyleProp | -- |
theme | SliderProps.theme 文档:https://panel-docs.tuyacn.com/docs/data-entry/slider | Record | -- |
backgroundColor | 组件背景颜色 | string | -- |
radius | 组件背景圆角 | number | -- |
trackStyle | 滑动槽样式 | StyleProp | -- |
value | 滑动条的值 | number | -- |
unit | 参数的单位 | string | -- |
hasControl | 滑动条是否为受控的 | boolean | false |
canTouchTrack | 触摸轨道是否可以更改值 | boolean | false |
disabled | 是否禁用 | boolean | -- |
type | 滑块的类型,parcel:包裹类型 | "parcel" | "normal" | normal |
renderMinimumTrack | 定制渲染小于当前值的轨道 | () => ReactElement | -- |
renderTitle | 自定义渲染标题 | (value: number) => ReactElement | -- |
padding | 外层容器的padding [上,右,下,左] | 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" | -- |
sliderBgColor | 滑动条背景色 | string | -- |
sliderGrooveBgColor | 滑动槽背景色 | string | -- |
sliderThumbColor | 滑块颜色 | string | -- |
sliderThumbSize | 滑块大小 | number | -- |
sliderThumbRadius | 滑块圆角 | number | -- |
bottomPromptTexts | 底部左右提示文字 | [string, string] | -- |
bottomPromptTextFontSize | 底部提示文字字体大小 | number | -- |
bottomPromptTextFontColor | 底部提示文字字体颜色 | string | -- |
bottomPromptTextFontWeight | 底部提示文字字重 | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
bothSideIcons | 滑动条两侧的图标 | [IconItem, IconItem] | -- |
bothSideIconSize | 滑动条两侧图标的尺寸 | number | -- |
bothSideIconColor | 滑动条两侧图标的颜色 | string | -- |
renderValue | 自定义的值的渲染 | (value: number) => ReactNode | -- |
iconIsImage | 卡片图标是否为图片 | boolean | false |