对我来说,在React中创建一个带有Material-Ui的Button是不可能的,因为React有多行功能。
这是我的代码:
<Button>
<Typography variant="h3">Text1</Typography>
<Typography variant="h5">Text2</Typography>
</Button>当前结果:Text1Text2
我想要的是:
Text1
Text2第一个文本应为variant=h3,第二个文本变体为v=5。谢谢!
发布于 2021-08-16 11:08:01
您可以将按钮设置为block的display样式。并根据您的要求对齐文本。
在此处探索有效的解决方案:
<Button style={{ display: "block", textAlign: "left" }}>
<Typography
variant="h3"
>
Text1
</Typography>
<Typography variant="h5">Text2</Typography>
</Button>
https://stackoverflow.com/questions/68801364
复制相似问题