Material UI Avatar 组件尺寸不变

Mis*_*ian 3 reactjs material-ui

我有这个组件

import React, { FC } from "react";
import { Avatar } from "@material-ui/core";

export interface AvatarProps {
  alt?: string;
  src: string;
  variant?: "circle" | "rounded" | "square";
  sizes?: string;
}

const Component: FC<AvatarProps> = (props: AvatarProps): JSX.Element => {
  return <Avatar {...props}></Avatar>;
};

export default Component;
Run Code Online (Sandbox Code Playgroud)

我正在尝试设置大小属性,但它没有改变。它究竟有什么价值?

Ste*_*eve 6

向下滚动到 img 的大小属性并阅读。

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

或者只使用文档中所示的 makeStyles :

https://material-ui.com/components/avatars/#SizeAvatars.js

或者另一种选择是简单的内联样式:

<Avatar style={{ height: '70px', width: '70px' }}></Avatar>
Run Code Online (Sandbox Code Playgroud)