--- order: 2 title: zh-CN: 带 icon 的滑块 en-US: Slider with icon --- ## zh-CN 滑块左右可以设置图标来表达业务含义。 ## en-US You can add an icon beside the slider to make it meaningful. ````__react import { Slider, Icon } from 'antd'; const IconSlider = React.createClass({ getInitialState() { const max = this.props.max; const min = this.props.min; const mid = ((max - min) / 2).toFixed(5); return { preIconClass: this.props.value >= mid ? '' : 'anticon-highlight', nextIconClass: this.props.value >= mid ? 'anticon-highlight' : '', mid, sliderValue: this.props.value, }; }, handleChange(v) { this.setState({ preIconClass: v >= this.state.mid ? '' : 'anticon-highlight', nextIconClass: v >= this.state.mid ? 'anticon-highlight' : '', sliderValue: v, }); }, render() { return (