Render Full Calendar of DatePicker on a page

∥☆過路亽.° 提交于 2019-12-12 03:30:56

问题


I'm trying out React to make a simple application.

I like how the full calendar looks like of the following date pickers (after clicking):

  • Material-UI
  • React-Toolbox

Is it possible to extract out the full calendar out onto a page without having to click to open the calendar modal/dialog? Just like in Google Calendar apps.

For example, I'd like to display the calendar on the main page of the app.


回答1:


Have a look at the Calendar component in material-ui library. You should be able to use it directly -

import Calendar from 'material-ui/lib/date-picker/calendar';

For an example on how to use it, look inside the DatePickerDialog component code.

<Calendar
      DateTimeFormat={DateTimeFormat}
      firstDayOfWeek={firstDayOfWeek}
      locale={locale}
      ref="calendar"
      onDayTouchTap={this.handleTouchTapDay}
      initialDate={this.props.initialDate}
      open={this.state.open}
      minDate={this.props.minDate}
      maxDate={this.props.maxDate}
      shouldDisableDate={this.props.shouldDisableDate}
      disableYearSelection={this.props.disableYearSelection}
      mode={this.props.mode}
    />


来源:https://stackoverflow.com/questions/35378272/render-full-calendar-of-datepicker-on-a-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!