如何在 Material UI 中为 Textfield 类型日期设置“min”属性?

2023-12-19

看来可以设置最小归因Input https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date输入日期。是否也可以设置最小归因文本域 https://material-ui.com/components/pickers/在 Material UI 中输入日期? 看来下面的代码不能很好地工作。

    <TextField
      id="date"
      label="Date"
      type="date"
      min="2020-08-10"
      defaultValue="mm-dd-yyyy"
      onChange={props.handleTime}
      className={classes.date}
      InputLabelProps={{
        shrink: true,
      }}
    />

你可以通过min and max价值观使用inputProps范围:

      <TextField
        id="date"
        label="Date"
        type="date"
        defaultValue="2020-08-15"
        InputLabelProps={{
          shrink: true,
        }}
        inputProps={{
          min: "2020-08-10",
          max: "2020-08-20"
        }}
      />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Material UI 中为 Textfield 类型日期设置“min”属性? 的相关文章

随机推荐