【问题标题】:Render Full Calendar of DatePicker on a page在页面上渲染 DatePicker 的完整日历
【发布时间】:2016-05-24 12:39:55
【问题描述】:

我正在尝试使用 React 来制作一个简单的应用程序。

我喜欢以下日期选择器的完整日历的外观(点击后):

是否可以将完整的日历提取到页面上而无需单击打开日历模式/对话框?就像在 Google 日历应用中一样。

例如,我想在应用程序的主页上显示日历。

【问题讨论】:

    标签: javascript reactjs datepicker calendar material-ui


    【解决方案1】:

    查看 material-ui 库中的Calendar component。你应该可以直接使用它-

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

    有关如何使用它的示例,请查看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}
        />
    

    【讨论】:

    • 嘿,谢谢!这就是我在挖掘源代码后所做的。再次感谢
    • 很高兴知道这一点。如果有帮助,请采纳答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-23
    • 1970-01-01
    • 2020-09-08
    • 1970-01-01
    • 1970-01-01
    • 2013-08-12
    • 2021-05-03
    相关资源
    最近更新 更多