diff options
author | yiminghe <yiminghe@gmail.com> | 2016-08-04 19:54:59 +0800 |
---|---|---|
committer | yiminghe <yiminghe@gmail.com> | 2016-08-04 19:54:59 +0800 |
commit | 40e6f165fecf11a01159ff3e1ddd9e37af3cb492 (patch) | |
tree | 7dcc572302d0f49a5e6499024f402836a8d8ae84 /examples/value-and-defaultValue.js | |
parent | 6cadbb3ade01969826b676b91182b3862f9c4d19 (diff) | |
download | time-picker-40e6f165fecf11a01159ff3e1ddd9e37af3cb492.tar.gz time-picker-40e6f165fecf11a01159ff3e1ddd9e37af3cb492.tar.zst time-picker-40e6f165fecf11a01159ff3e1ddd9e37af3cb492.zip |
Updates
Diffstat (limited to 'examples/value-and-defaultValue.js')
-rw-r--r-- | examples/value-and-defaultValue.js | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/examples/value-and-defaultValue.js b/examples/value-and-defaultValue.js index 4c295a6..9d092f3 100644 --- a/examples/value-and-defaultValue.js +++ b/examples/value-and-defaultValue.js | |||
@@ -3,61 +3,45 @@ webpackJsonp([3],{ | |||
3 | /***/ 0: | 3 | /***/ 0: |
4 | /***/ function(module, exports, __webpack_require__) { | 4 | /***/ function(module, exports, __webpack_require__) { |
5 | 5 | ||
6 | module.exports = __webpack_require__(232); | 6 | module.exports = __webpack_require__(240); |
7 | 7 | ||
8 | 8 | ||
9 | /***/ }, | 9 | /***/ }, |
10 | 10 | ||
11 | /***/ 232: | 11 | /***/ 240: |
12 | /***/ function(module, exports, __webpack_require__) { | 12 | /***/ function(module, exports, __webpack_require__) { |
13 | 13 | ||
14 | /* eslint no-console:0 */ | ||
15 | |||
16 | 'use strict'; | 14 | 'use strict'; |
17 | 15 | ||
18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
19 | |||
20 | __webpack_require__(2); | 16 | __webpack_require__(2); |
21 | 17 | ||
22 | var _react = __webpack_require__(3); | 18 | var _react = __webpack_require__(3); |
23 | 19 | ||
24 | var _react2 = _interopRequireDefault(_react); | 20 | var _react2 = _interopRequireDefault(_react); |
25 | 21 | ||
26 | var _reactDom = __webpack_require__(160); | 22 | var _reactDom = __webpack_require__(37); |
27 | 23 | ||
28 | var _reactDom2 = _interopRequireDefault(_reactDom); | 24 | var _reactDom2 = _interopRequireDefault(_reactDom); |
29 | 25 | ||
30 | var _gregorianCalendar = __webpack_require__(161); | 26 | var _moment = __webpack_require__(177); |
31 | |||
32 | var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); | ||
33 | |||
34 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
35 | 27 | ||
36 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | 28 | var _moment2 = _interopRequireDefault(_moment); |
37 | 29 | ||
38 | var _rcTimePicker = __webpack_require__(168); | 30 | var _rcTimePicker = __webpack_require__(178); |
39 | 31 | ||
40 | var _rcTimePicker2 = _interopRequireDefault(_rcTimePicker); | 32 | var _rcTimePicker2 = _interopRequireDefault(_rcTimePicker); |
41 | 33 | ||
42 | var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(227); | 34 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
43 | 35 | ||
44 | var _rcTimePickerSrcLocaleZh_CN2 = _interopRequireDefault(_rcTimePickerSrcLocaleZh_CN); | 36 | var App = _react2.default.createClass({ |
45 | |||
46 | var formatter = new _gregorianCalendarFormat2['default']('HH:mm:ss'); | ||
47 | |||
48 | var now = new _gregorianCalendar2['default'](_rcTimePickerSrcLocaleZh_CN2['default'].calendar); | ||
49 | now.setTime(Date.now()); | ||
50 | |||
51 | var App = _react2['default'].createClass({ | ||
52 | displayName: 'App', | 37 | displayName: 'App', |
53 | |||
54 | getInitialState: function getInitialState() { | 38 | getInitialState: function getInitialState() { |
55 | return { | 39 | return { |
56 | value: now | 40 | value: (0, _moment2.default)() |
57 | }; | 41 | }; |
58 | }, | 42 | }, |
59 | handleValueChange: function handleValueChange(value) { | 43 | handleValueChange: function handleValueChange(value) { |
60 | console.log(value && formatter.format(value)); | 44 | console.log(value && value.format('HH:mm:ss')); |
61 | this.setState({ value: value }); | 45 | this.setState({ value: value }); |
62 | }, | 46 | }, |
63 | clear: function clear() { | 47 | clear: function clear() { |
@@ -66,24 +50,27 @@ webpackJsonp([3],{ | |||
66 | }); | 50 | }); |
67 | }, | 51 | }, |
68 | render: function render() { | 52 | render: function render() { |
69 | return _react2['default'].createElement( | 53 | return _react2.default.createElement( |
70 | 'div', | 54 | 'div', |
71 | null, | 55 | null, |
72 | _react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], | 56 | _react2.default.createElement(_rcTimePicker2.default, { |
73 | defaultValue: now }), | 57 | defaultValue: this.state.value, |
74 | _react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], | 58 | onChange: this.handleValueChange |
59 | }), | ||
60 | _react2.default.createElement(_rcTimePicker2.default, { | ||
75 | value: this.state.value, | 61 | value: this.state.value, |
76 | onChange: this.handleValueChange }), | 62 | onChange: this.handleValueChange |
77 | _react2['default'].createElement( | 63 | }), |
64 | _react2.default.createElement( | ||
78 | 'button', | 65 | 'button', |
79 | { onClick: this.clear }, | 66 | { onClick: this.clear }, |
80 | 'clear' | 67 | 'clear' |
81 | ) | 68 | ) |
82 | ); | 69 | ); |
83 | } | 70 | } |
84 | }); | 71 | }); /* eslint no-console:0 */ |
85 | 72 | ||
86 | _reactDom2['default'].render(_react2['default'].createElement(App, null), document.getElementById('__react-content')); | 73 | _reactDom2.default.render(_react2.default.createElement(App, null), document.getElementById('__react-content')); |
87 | 74 | ||
88 | /***/ } | 75 | /***/ } |
89 | 76 | ||