feat: upgrade rc-slider

This commit is contained in:
Benjy Cui 2015-11-18 16:54:38 +08:00
parent 93f5928e1a
commit 46f004877c
2 changed files with 30 additions and 2 deletions

View File

@ -9,6 +9,34 @@ export default React.createClass({
};
},
render() {
return <Slider {...this.props} />;
const {isIncluded, marks, index, defaultIndex, ...rest} = this.props;
if (isIncluded !== undefined) {
// `isIncluded`
rest.included = isIncluded;
}
if (Array.isArray(marks)) {
// marks
rest.min = 0;
rest.max = marks.length - 1;
rest.step = 1;
if (index !== undefined) {
rest.value = index;
}
if (defaultIndex !== undefined) {
rest.defaultValue = defaultIndex;
}
rest.marks = {};
marks.forEach((val, idx) => {
rest.marks[idx] = val;
});
} else {
rest.marks = marks;
}
return <Slider {...rest} />;
}
});

View File

@ -52,7 +52,7 @@
"rc-queue-anim": "~0.11.2",
"rc-radio": "~2.0.0",
"rc-select": "~5.1.2",
"rc-slider": "~2.3.2",
"rc-slider": "~3.0.0",
"rc-steps": "~1.4.1",
"rc-switch": "~1.3.1",
"rc-table": "~3.6.1",