mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
feat: upgrade rc-slider
This commit is contained in:
parent
93f5928e1a
commit
46f004877c
@ -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} />;
|
||||
}
|
||||
});
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user