yylib-quick-mobile
Version:
yylib-quick-mobile
35 lines (31 loc) • 1.07 kB
JavaScript
/**
* Created By whh 2017/12/26
* */
import React from 'react';
import {Slider} from 'antd-mobile';
import {isFunction} from '../../utils/FunctionUtil';
import classnames from 'classnames';
class YYSlider extends React.Component {
//当 Slider 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入。
_onChange = (val) => {
if (isFunction(this.props.onChange)) this.props.onChange(val)
}
//与 ontouchend 触发时机一致,把当前值作为参数传入。
_onAfterChange=(val)=>{
if (isFunction(this.props.onAfterChange)) this.props.onAfterChange(val)
}
render() {
let wrapClz = classnames('yy-slider', this.props.className);
const {...restProps} = this.props;
return (
<Slider
className={wrapClz}
{...restProps}
onChange={this._onChange}
onAfterChange={this._onAfterChange}/>
)
};
}
YYSlider.defaultProps = {
}
export default YYSlider;