UNPKG

cjd-parkball

Version:

> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用

59 lines (46 loc) 1.39 kB
--- category: 2 title: 带标签的滑块 title_en: Graduated slider --- zh-CN 使用 `marks` 属性标注分段式滑块,使用 `value` / `defaultValue` 指定滑块位置。当 `included=false` 时,表明不同标记间为并列关系。当 `step=null` 时,Slider 的可选值仅有 `marks` 标出来的部分。 en-US Using `marks` property to mark a graduated slider, use `value` or `defaultValue` to specify the position of thumb. When `included` is false, means that different thumbs are coordinative. when `step` is null, users can only slide the thumbs onto marks. ````jsx import { Slider } from 'parkball'; const marks = { 0: '0°C', 26: '26°C', 37: '37°C', 100: { style: { color: '#f50', }, label: <strong>100°C</strong>, }, }; ReactDOM.render( <div> <h4>included=true</h4> <Slider marks={marks} defaultValue={37} /> <Slider range marks={marks} defaultValue={[26, 37]} /> <h4>included=false</h4> <Slider marks={marks} included={false} defaultValue={37} /> <h4>marks & step</h4> <Slider marks={marks} step={10} defaultValue={37} /> <h4>step=null</h4> <Slider marks={marks} step={null} defaultValue={37} /> </div>, mountNode); ```` <style> #components-slider-demo-mark h4 { margin: 0 0 16px; } #components-slider-demo-mark .ant-slider-with-marks { margin-bottom: 44px; } </style>