首页 > 解决方案 > 如何为材料选择器实现默认工具栏以进行反应?

问题描述

我正在尝试通过在对话框中添加标题来自定义材质选择器(v3)的工具栏。在这个线程之后,我能够为 KeyboardDatePicker 做到这一点。( https://github.com/mui-org/material-ui-pickers/issues/1180 ) 但我还需要在 KeyboardTimePicker 中实现它。

我试图通过将视图更改为小时和分钟来做到这一点,但它们与 KeyboardTimePicker 中的默认工具栏不同(默认工具栏也可以在顶部编辑时间)

有人可以帮我弄这个吗

标签: javascriptreactjswebmaterial-uifrontend

解决方案


Solved it by below and added additional component on top of the TimePickerToolbar

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

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

推荐阅读