From 813a4ce6312a083901e64ed4fab852edc93df8e6 Mon Sep 17 00:00:00 2001 From: zhangjunjie Date: Tue, 11 Dec 2018 14:37:22 +0800 Subject: [PATCH] fix:Checkbox unable to trigger;fix:DatePicker click the icon triggers the location incorrectly --- components/checkbox/style/index.scss | 1 + components/date-picker/BasePicker.js | 1 + docs/zh-CN/date-picker.md | 119 +++++++++++++++++---------- 3 files changed, 76 insertions(+), 45 deletions(-) diff --git a/components/checkbox/style/index.scss b/components/checkbox/style/index.scss index 79ea1e11c..a24177041 100644 --- a/components/checkbox/style/index.scss +++ b/components/checkbox/style/index.scss @@ -83,6 +83,7 @@ left: 3px; right: 3px; top: 50%; + pointer-events: none; } } } diff --git a/components/date-picker/BasePicker.js b/components/date-picker/BasePicker.js index 14eb11182..a9397ff2a 100644 --- a/components/date-picker/BasePicker.js +++ b/components/date-picker/BasePicker.js @@ -258,6 +258,7 @@ class BasePicker extends Component { ? : { if (this.props.disabled) return + this.calcPanelPos(this.inputRoot.getBoundingClientRect()) this.setState({showPanel: true, isFocus: true}) }} /> } diff --git a/docs/zh-CN/date-picker.md b/docs/zh-CN/date-picker.md index 1697fe0eb..09d57c71e 100644 --- a/docs/zh-CN/date-picker.md +++ b/docs/zh-CN/date-picker.md @@ -18,52 +18,71 @@ constructor() { } render () { return ( -
- - { - console.log('value 为 Date 实例', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log(' value 为 Number(毫秒数)', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log('value 为 时间字符串', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log('没有 value 属性', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log('value 为 Null', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log('value 为 undefined', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> - { - console.log('value 为 空字符串', DatePicker.format(d, 'YYYY-MM-DD E')) - }} - /> +
+
+

Date 实例:

+ { + console.log('value 为 Date 实例', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
- {this.setState({date: new Date()})}}>重置 +
+

毫秒值(number):

+ { + console.log(' value 为 Number(毫秒数)', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
+
+

时间字符串:

+ { + console.log('value 为 时间字符串', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
+
+

未传入 value:

+ { + console.log('没有 value 属性', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
+
+

null:

+ { + console.log('value 为 Null', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
+
+

undefined:

+ { + console.log('value 为 undefined', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
+
+

空字符串:

+ { + console.log('value 为 空字符串', DatePicker.format(d, 'YYYY-MM-DD E')) + }} + /> +
) } @@ -96,11 +115,21 @@ render () { 禁用日期 ```js +constructor () { + super() + this.state = { + date: new Date() + } +} render () { return ( { + this.setState({date}) + }} /> ) }