You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/vc-slider/demo/handle.jsx

55 lines
1.3 KiB

7 years ago
import Slider from '../index'
import Tooltip from '../../vc-tooltip'
import '../assets/index.less'
import '../../vc-tooltip/assets/bootstrap.less'
const { createSliderWithTooltip, Handle } = Slider
const Range = createSliderWithTooltip(Slider.Range)
export default {
data () {
return {
}
},
render () {
const handle = (props) => {
7 years ago
const { value, dragging, index, refStr, ...restProps } = props
7 years ago
const handleProps = {
props: {
...restProps,
value,
},
7 years ago
attrs: {
refStr,
},
7 years ago
key: index,
}
return (
<Tooltip
prefixCls='rc-slider-tooltip'
overlay={value}
visible={dragging}
placement='top'
key={index}
>
<Handle {...handleProps} />
</Tooltip>
)
}
const wrapperStyle = 'width: 400px; margin: 50px'
return (
<div>
<div style={wrapperStyle}>
<p>Slider with custom handle</p>
<Slider min={0} max={20} defaultValue={3} handle={handle} />
</div>
{/* <div style={wrapperStyle}>
<p>Range with custom handle</p>
<Range min={0} max={20} defaultValue={[3, 10]} tipFormatter={value => `${value}%`} />
</div> */}
</div>
)
},
}