我正在尝试创建一个滑块以选择一天中的某个时段。我想找到一种方法在第一个手柄上显示“开始”,在第二个手柄上显示“停止”。但是我找不到从文档中执行此操作的方法,似乎我只能在工具提示中显示当前位置值,但是必须有一种方法。
最后,如果开始<停止值,我希望默认显示绿色渐变,但是如果开始>停止值,则css应该从第二个(在这种情况下为“开始”)句柄到末尾着色,并且从开始到第一,手柄之间的空间为灰色。
这是我正在实现的代码:
<RangeWithToolTip
tipFormatter={convertFloatToTime}
tipProps={{ placement: "top", prefixCls: "rc-slider-tooltip" }}
min={0}
max={24}
step={0.25}
defaultValue={props.time2 ? props.time2 : [8, 12]}
//value={[times.sliderValue, times.sliderValue]}
onChange={onSliderChange}
handleStyle={[
{
backgroundColor: "white",
width: "23px",
height: "23px",
border: "2px solid #4caf50",
marginLeft: -12
}
]}
trackStyle={[
{
marginTop: -5,
height: 22,
borderRadius: 15,
background:
"linear-gradient(to right, #0fff3b 0%, #009639 100%)"
}
]}
/>
尽管我有一些疑问,例如tipProps,但我看不到prefixCls是什么意思,或者这是否可以以任何方式帮助我。