lanjingling0510 / react-mobile-datepicker

🙊 👻 look a demo, Please imitate mobile environment.
https://codepen.io/lanjingling0510/pen/LRpOYp?editors=1010
MIT License
303 stars 148 forks source link

onSelect事件中参数错误 #12

Closed wzsxyz closed 7 years ago

wzsxyz commented 7 years ago

onSelect事件中获取的参数是永远是初始时的时间,这导致组件完全失去意义。这bug也太夸张了吧?

lanjingling0510 commented 7 years ago

@wzsxyz 不知道你是怎么使用的,发下你的用例

wzsxyz commented 7 years ago

http://test1.npm.yijifu.net/__build/demo.html

js代码:

/**

var React = require('react'); var ReactDom = require('react-dom');

var RMDatePicker = require('react-mobile-datepicker');

var DatePicker = React.createClass({ getInitialState: function(){ return { isOpen: false, time: new Date(), value: '' } }, componentDidMount: function(){ var _this = this; $('body').on('click', '.datepicker-modal', function(){ _this.setState({ isOpen: false }); }) }, render: function(){ var _this = this; return (

1?month:'0'+month) _this.setState({ time: date, value: v }) }} />
        )
}

});

ReactDom.render(<DatePicker

/>, $('.js-date')[0]);
lanjingling0510 commented 7 years ago

@wzsxyz https://codepen.io/lanjingling0510/pen/yXdoNB 关闭datepicker-modal直接在onSelect回调里控制