Reactjs React JS-如何在对话框的PaperProps中添加样式(材质ui)

Reactjs React JS-如何在对话框的PaperProps中添加样式(材质ui),reactjs,dialog,material-ui,inline-styles,overriding,Reactjs,Dialog,Material Ui,Inline Styles,Overriding,我正在使用material ui中的对话框组件 <Dialog fullScreen open={this.state.open} PaperProps={{ classes: {root: classes.dialogPaper} }} onClose={this.handleClose.bind(this)} transition={this.props.transition}> {this.props.children} </Dialog> {thi

我正在使用material ui中的对话框组件

<Dialog fullScreen open={this.state.open}
  PaperProps={{ classes: {root: classes.dialogPaper} }}
  onClose={this.handleClose.bind(this)} transition={this.props.transition}>
  {this.props.children}
</Dialog>

{this.props.children}
在上面的代码中,我已经重写了PaperProps的根类。现在我还想覆盖PaperProps中的样式。这是否可能在PaperProps中覆盖样式

类似于
PaperProps={{classes:{root:classes.dialogPaper},style:{}}

如果我错了,请告诉我。我还想重写样式。

我得到了答案

<Dialog
{...otherProps}
  PaperProps={{
    style: {
      backgroundColor: 'transparent',
      boxShadow: 'none',
    },
  }}
>
  {/* ... your content ... */}
</Dialog>

{/*…您的内容…*/}
这就是我们如何在对话组件的PaperProps中添加样式的方法。

我得到了答案

<Dialog
{...otherProps}
  PaperProps={{
    style: {
      backgroundColor: 'transparent',
      boxShadow: 'none',
    },
  }}
>
  {/* ... your content ... */}
</Dialog>
<Dialog
  PaperProps={{
    style: {
      backgroundColor: 'Blue',
      color:'black'
    },
  }}
>
</Dialog>

{/*…您的内容…*/}
这就是我们如何在对话框组件的PaperProps中添加样式的方法。


<Dialog
  PaperProps={{
    style: {
      backgroundColor: 'Blue',
      color:'black'
    },
  }}
>
</Dialog>


您能分享一下为什么要覆盖内联样式和
属性吗?因此,我创建了一个对话框的通用组件,该组件在项目中的任何地方都使用override类,因为要在对话框的纸张组件中添加一些填充和更多属性,所以我使用PaperProps覆盖它,但现在使用了相同的组件在代码中的某个地方,PaperProps类不需要填充,所以我需要使用PaperProps中的样式来重写它。我希望你现在明白了。你能分享一下为什么你想覆盖内联样式和
属性吗?所以我创建了一个对话框的通用组件,它在项目中的任何地方都可以使用覆盖类,因为要在对话框的纸张组件中添加一些填充和更多属性,所以我使用PaperProps覆盖它,但现在代码中的某个地方使用了相同的组件,PaperProps类中不需要填充,所以我需要使用PaperProps中的样式覆盖它。我希望你现在明白了。请不要只发布代码作为答案,而是解释代码的作用以及它如何解决问题。带有解释的答案通常质量更高,更有可能吸引更多的投票。请不要只发布代码作为答案,而是包括解释代码的作用以及它如何解决问题。带有解释的答案通常质量更高,更有可能吸引更多的选票。