【问题标题】:How to make the dialog of Material-UI take the shape of an image如何让Material-UI的对话框变成图片的形状
【发布时间】:2020-08-25 12:42:09
【问题描述】:

如何制作对话框,取图片大小。

并且将背景颜色更改为透明也不起作用

【问题讨论】:

标签: html css reactjs dialog material-ui


【解决方案1】:

通过以下代码实现!

import { makeStyles } from "@material-ui/core/styles";

const useStyles = makeStyles({
  paper: {
    backgroundColor: "transparent",
  }
});

function Counselling() {
  const classes = useStyles();

  return (
    <div style={{ position: "absolute", top: "455px", left: "20px" }}>
      <Button variant="outlined" color="secondary" onClick={handleClickOpen}>
        Free Counselling
      </Button>
      <Dialog
        open={open}
        onClose={handleClose}
        aria-labelledby="alert-dialog-title"
        aria-describedby="alert-dialog-description"
        maxWidth="md"
        style={{ backgroundColor: "rgba(0, 0, 0, 0.7)" }}
        classes={{
          paper: classes.paper
        }}
      >
}

这是覆盖 react 主题

export default {
  overrides: {
    MuiPaper: {
      elevation24: {
        boxShadow: "none"
      }
    }
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-17
    • 1970-01-01
    • 2018-03-04
    • 1970-01-01
    • 2021-11-21
    • 2018-08-01
    相关资源
    最近更新 更多