diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-12-12 20:34:00 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-12-12 20:34:00 +0800 |
commit | 518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6 (patch) | |
tree | 664ef5377589dc3c4def7e732dfaa76e89da1fb1 /src/module/Select.jsx | |
parent | 182e9fccc90ae709322b7cc314c8775a9d8d46b8 (diff) | |
download | time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.tar.gz time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.tar.zst time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.zip |
add new options about disabled time
Diffstat (limited to 'src/module/Select.jsx')
-rw-r--r-- | src/module/Select.jsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/module/Select.jsx b/src/module/Select.jsx index 3659692..ab10789 100644 --- a/src/module/Select.jsx +++ b/src/module/Select.jsx | |||
@@ -51,11 +51,15 @@ const Select = React.createClass({ | |||
51 | getOptions() { | 51 | getOptions() { |
52 | const { options, selectedIndex, prefixCls } = this.props; | 52 | const { options, selectedIndex, prefixCls } = this.props; |
53 | return options.map((item, index) => { | 53 | return options.map((item, index) => { |
54 | const selected = selectedIndex === index; | ||
55 | const cls = classnames({ | 54 | const cls = classnames({ |
56 | [`${prefixCls}-select-option-selected`]: selected, | 55 | [`${prefixCls}-select-option-selected`]: selectedIndex === index, |
56 | [`${prefixCls}-select-option-disabled`]: item.disabled, | ||
57 | }); | 57 | }); |
58 | return <li className={cls} key={index} onClick={this.onSelect.bind(this, +item)}>{item}</li>; | 58 | let onclick = null; |
59 | if (!item.disabled) { | ||
60 | onclick = this.onSelect.bind(this, +item.value); | ||
61 | } | ||
62 | return <li className={cls} key={index} onClick={onclick} disabled={item.disabled}>{item.value}</li>; | ||
59 | }); | 63 | }); |
60 | }, | 64 | }, |
61 | 65 | ||