我使用List
内部的反应材料组件ul li
。我想添加样式li
(添加底部边框)。一种方法是添加这个className={classes.sideBar__listItem__element}
有ListItem
没有更好的方法来做嵌套?
https://codesandbox.io/s/1yr3nlqp74
import React, { Fragment } from "react";
import { Paper, ListItem, List, ListItemText } from "@material-ui/core";
import { withStyles } from "@material-ui/core/styles";
const styles = {
sideBar__block: {
padding: 20
},
sideBar__list__element: {
li: {
borderBottom: "1px solid rgb(212, 212, 212)"
}
},
sideBar__listItem__element: {
borderBottom: "1px solid rgb(212, 212, 212)"
}
};
const SideBar = props => {
const { classes } = props;
return (
<div className={classes.sideBar__block}>
<Paper className={classes.sideBar__list__element}>
<List>
<ListItem className={classes.sideBar__listItem__element}>
<ListItemText primary="form" secondary=" FORM" />
</ListItem>
<ListItem>
<ListItemText primary="E" secondary=" Inbox" />
</ListItem>
<ListItem>
<ListItemText primary="re box" secondary=" Inbox" />
</ListItem>
<ListItem>
<ListItemText primary="Upload" secondary="upload" />
</ListItem>
</List>
</Paper>
</div>
);
};
export default withStyles(styles)(SideBar);
我正在使用这个例子 https://material-ui.com/demos/lists/