简体   繁体   English

如何为反应的材料选择器实现默认工具栏?

[英]How to implement default toolbar for material picker for react?

I'm trying to customize toolbar for material picker (v3) by adding title inside the dialog.我正在尝试通过在对话框中添加标题来为材料选择器 (v3) 自定义工具栏。 I was able to do that for the KeyboardDatePicker following this thread.我能够在这个线程之后为 KeyboardDatePicker 做到这一点。 ( https://github.com/mui-org/material-ui-pickers/issues/1180 ) But I also need to implement it in the KeyboardTimePicker. ( https://github.com/mui-org/material-ui-pickers/issues/1180 ) 但是我还需要在KeyboardTimePicker中实现它。

I tried to do it by changing the views to hours and minutes but they weren't same as the default toolbar in the KeyboardTimePicker (default toolbar can edit time on top also)我试图通过将视图更改为小时和分钟来做到这一点,但它们与 KeyboardTimePicker 中的默认工具栏不同(默认工具栏也可以在顶部编辑时间)

Can someone help me with this有人可以帮我弄这个吗

Solved it by below and added additional component on top of the TimePickerToolbar通过下面解决它并在 TimePickerToolbar 顶部添加了额外的组件

import { T as TimePickerToolbar } from '@material-ui/pickers/esm/TimePickerToolbar-81100fab.js';

<KeyboardTimePicker
        ToolbarComponent={(props) => <TimePickerToolbar {...props}/>
      />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM