[英]How to disable particular time slots in timepicker material UI
So i have a array of timeslots from which i want user to pick a time lets say所以我有一系列时隙,我希望用户从中选择一个时间让我们说
var arr = ["11:00:00","11:10:00","13:00:00"]
how can i disable other time slots from timepicker and only enable this time slots如何从 timepicker 禁用其他时隙并仅启用此时隙
My TimePicker我的时间选择器
<TimePicker
label="Time"
value={value}
onChange={handleChange}
renderInput={(params) => <TextField {...params} />}
/>
Array of TimeSlots i want user to pick from我希望用户从中选择的 TimeSlots 数组
var timeSlots = [ "10:00", "10:30", "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", … ]
Actaully im getting this timeslots array from api实际上我从 api 得到这个时隙数组
Hey Ronak you can use Filter() function of ES6 to get limited or particular timeslot.嘿,Ronak,您可以使用 ES6 的 Filter() function 来获得有限或特定的时隙。 Try to use filter while fetching the timeSlot from API.在从 API 获取 timeSlot 时尝试使用过滤器。 If you still face any error just lemme know.如果您仍然面临任何错误,请让我知道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.