Javascript 如何设置材质ui时间选择器dilog样式
我正在整合 我需要改变时间的颜色 你可以在图中看到。我需要更改Javascript 如何设置材质ui时间选择器dilog样式,javascript,reactjs,material-ui,Javascript,Reactjs,Material Ui,我正在整合 我需要改变时间的颜色 你可以在图中看到。我需要更改11:30 pm的颜色。我还需要改变dilog盒子的宽度和高度 我试过了,但没用 const theme = createMuiTheme({ palette: { primary: { main: '#efbb40' } }, typography: { useNextVariants: true, suppressDeprecationWarnings: true }
11:30 pm
的颜色。我还需要改变dilog盒子的宽度和高度
我试过了,但没用
const theme = createMuiTheme({
palette: {
primary: {
main: '#efbb40'
}
},
typography: {
useNextVariants: true,
suppressDeprecationWarnings: true
}
})
我找了很多,但都找不到
请帮忙 我已经阅读了node_模块中时间选择器的原始代码。其中的样式定义不同于material-ui。因此,我在这里提供了一个覆盖它们的选项 首先,将节点_modules/material ui time picker/lib/TimePicker.js中的代码复制到TimePicker.js中,并记住更改以下两部分
var _Clock = require('material-ui-time-picker/lib/Clock');
var _util = require('material-ui-time-picker/lib/util');
第二,从TimePicker.js而不是从node_模块导入TimePicker
import TimePicker from './TimePicker'
<Button
onClick={() => this.setState({ open: true })}
>
Open time picker
</Button>
<Dialog
maxWidth='xs'
open={this.state.open}
>
<TimePicker/>
<DialogActions>
<Button onClick={() => this.setState({ open: false })} color='primary'>
Cancel
</Button>
<Button onClick={() => this.setState({ open: false })} color='primary'>
Ok
</Button>
</DialogActions>
</Dialog>
从“./TimePicker”导入时间选择器
this.setState({open:true})}
>
开放时间选择器
this.setState({open:false})color='primary'>
取消
this.setState({open:false})color='primary'>
好啊
然后,您现在将获得相同的TimePicker。您可以随意更改TimePicker.js中的样式。这里有点复杂。您能提供一个codesandbox吗?我可以展示给您。@Root我不知道如何创建sandbox。我只是从中复制粘贴代码。请将您想展示的内容作为答案发布。@Root您能回答吗?我已经回答了。只是一个选项。希望能帮助您。