【发布时间】:2018-07-23 23:44:22
【问题描述】:
我正在使用 React 创建一些按钮和 CSS 来设置主题样式。 所以我创建了一个类 Button:
export default class Button extends React.Component{
public className: string;
constructor(props){
super(props);
this.className = props.className ? props.className : "";
}
public render() {
return (
<button className = {this.className}>
{this.value}
</button>
);
}
}
这是我的 CSS:
.my-css {
width: 300px;
height: 200px;
border-radius: 8px;
}
这就是我使用它的方式:
<Button className = "my-css" value = "Test" />
为什么在检查器中看不到我的规则已加载?
谢谢谁会回答我! :-)
【问题讨论】: