KeyboardDatePicker 不支持其输入字段的只读属性
我尝试了 API 文档中已经提到的 readOnly 属性,但没有解决。它对父容器应用只读,而不是对 KeyboardDatePicker 中的输入字段应用。
<KeyboardDatePicker
margin="normal"
id="mui-pickers-date"
className = "dialog-calendar"
value={selectedDate}
shouldDisableDate = {handleDisableDate}
minDate = {startDate}
maxDate = {endDate}
minDateMessage = ''
onChange={handleDateChange}
format = "MM/dd/yyyy"
disablePast = {true}
disabled = {isDisabled}
allowKeyboardControl = {false}
readOnly = {true}
autoFill = {false}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
Run Code Online (Sandbox Code Playgroud)