【问题标题】:Pass styles property to a Card component of Create View将样式属性传递给 Create View 的 Card 组件
【发布时间】:2019-10-24 22:54:08
【问题描述】:

我在Create 视图的底部有一个带有TabbedForm 的自动完成组件。

由于父 Card 组件的 overflow 设置为隐藏,下拉列表被隐藏。

有没有办法将style 属性传递给父Card 组件以覆盖默认的material-ui overflow 属性?

如果没有,我是否可以在渲染时使用任何 hack 来实现此目的?

【问题讨论】:

  • 我目前使用的解决方案是在 Themes.js 中全局覆盖,是否有另一种方法可以仅用于一个特定的视图/卡片?

标签: material-ui react-admin


【解决方案1】:

试试这个:

import { withStyles } from '@material-ui/core/styles'

const cardCreateStyles = {
  card: {
    overflow: 'scroll',
    backgroundColor: 'Lavender',
  }
}

const CardCreate = withStyles(cardCreateStyles)(({ classes, ...props }) => (
  <Create classes={classes} {...props} >
  ...
  </Create>
))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-09
    • 1970-01-01
    • 2016-12-24
    • 2019-04-30
    • 2019-07-25
    相关资源
    最近更新 更多