app.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Created by Ryn on 2016/8/7.
  3. * 入口文件
  4. */
  5. import '../style/style.css';
  6. import React from 'react';
  7. import ReactDOM from 'react-dom';
  8. import Calendar from '../components/Calendar';
  9. const App = React.createClass({
  10. getInitialState() {
  11. return {
  12. tags : [5, 21]
  13. }
  14. },
  15. selectDate(year, month, day) {
  16. console.log("选择时间为:" + year + '年' + month + '月' + day + '日' );
  17. },
  18. previousMonth(year, month) {
  19. console.log("当前日期为:" + year + '年' + month + '月');
  20. this.setState({tags : [7, 11]});
  21. },
  22. nextMonth(year, month) {
  23. console.log("当前日期为:" + year + '年' + month + '月');
  24. this.setState({tags : [8, 23]});
  25. },
  26. render() {
  27. return (
  28. <Calendar
  29. onSelectDate={this.selectDate}
  30. onPreviousMonth={this.previousMonth}
  31. onNextMonth={this.nextMonth}
  32. year="2016"
  33. month="8"
  34. day="7"
  35. tags={this.state.tags} />
  36. );
  37. }
  38. });
  39. ReactDOM.render(
  40. <App />,
  41. document.getElementById('datePicker')
  42. );