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.

32 lines
605 B

9 years ago
# 只显示部分选项
9 years ago
- order: 6
9 years ago
通过 `hideDisabledOptions` 将不可选的选项隐藏。
---
````jsx
import { TimePicker } from 'antd';
9 years ago
function newArray(start, end) {
let result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
function disabledMinutes() {
9 years ago
return newArray(0, 60).filter(value => value % 10 !== 0);
}
function disabledSeconds() {
9 years ago
return newArray(0, 60).filter(value => value % 30 !== 0);
}
ReactDOM.render(
9 years ago
<TimePicker disabledMinutes={disabledMinutes} disabledSeconds={disabledSeconds} hideDisabledOptions />
, mountNode);
````