代码之家  ›  专栏  ›  技术社区  ›  Kushal Jain

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

  •  0
  • Kushal Jain  · 技术社区  · 6 年前

    我正在使用来自material ui ReactJs的对话框组件。

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

    在上面的代码中,我已经重写了PaperProps的根类。现在我还想重写PaperProps中的样式。在PaperProps中可以覆盖样式吗。

    有点像 PaperProps={{ classes: {root: classes.dialogPaper}, style:{} }}

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

    1 回复  |  直到 6 年前
        1
  •  1
  •   Kushal Jain    6 年前

    我得到了答案

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

    这就是我们如何在对话框组件的PaperProps中放置样式的方法。

        2
  •  0
  •   Das_Geek Narendra Chennamsetti    5 年前
    <Dialog
      PaperProps={{
        style: {
          backgroundColor: 'Blue',
          color:'black'
        },
      }}
    >
    </Dialog>