如何将make GridList子级添加为组件

时间:2019-05-18 15:44:58

标签: reactjs material-ui

我想将GridList of react material-ui的子级作为组件,但是该子级组件没有maerial-ui的样式。如何使React组件继承GridList的样式? 我的代码如下:

const GridContain=(props)=>{
        return {tileData.map(tile => (
          <GridListTile key={tile.img}>
            <img src={tile.img} alt={tile.title} />
            <GridListTileBar
              title={tile.title}
              subtitle={<span>by: {tile.author}</span>}
              actionIcon={
                <IconButton className={classes.icon}>
                  <InfoIcon />
                </IconButton>
              }
            />
          </GridListTile>
        ))}

function TitlebarGridList(props) {
  const { classes } = props;

  return (
    <div className={classes.root}>
      <GridList cellHeight={180} className={classes.gridList}>
        <GridListTile key="Subheader" cols={2} style={{ height: 'auto' }}>
          <ListSubheader component="div">December</ListSubheader>
        </GridListTile>
        <GridContaint> //<<=== instead of the img, GridListTile, etc
      </GridList>
    </div>
  );
}

export default (TitlebarGridList);

0 个答案:

没有答案