我有使用material-ui 1.0.0-beta 31的以下组件。版式样式不会显示在页面上,并且所有文本都具有相同的样式。有人可以解释一下我做错了什么吗?
import React from 'react';
import Typography from 'material-ui/Typography';
const LearningPage = (props, { authUser }) =>
<div>
<Typography variant="headline" component="h2">
benevent
</Typography>
<Typography >adjective</Typography>
<Typography component="p">
well meaning and kindly.<br />
{'"a benevolent smile"'}
</Typography>
<Typography variant="headline" gutterBottom>
Headline
</Typography>
</div>
export default LearningPage;
最佳答案
material-ui 1.0.0-beta 31 中不存在 variant
属性。如 the release notes 中所述。 ,variant
属性是在 beta 32 中引入的。
在 beta 32 之前,type
属性与 variant
属性具有相同的作用。这是commit进行更改的位置,这里是 the issue如果您有兴趣,可以在其中讨论更改。
因此,您有两种选择来解决此问题:
- 升级到 beta 32。
- 保持 beta 31 不变,并将
variant
重命名为type
。
关于reactjs - Material-ui-next - 版式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48653318/