var MyElement = React.createClass({displayName: "FormatParagraph",
render: function () {
return (
React.createElement("p", null, this.props.paragraph)
);
}
});
Run Code Online (Sandbox Code Playgroud)
如何为此添加样式对象?
Mic*_*ley 26
第二个参数createElement是属性的散列,其中键是属性名称,值是属性值.该style属性将样式名称的哈希值赋予值.所以,例如:
React.createElement("p", {style: {color: "red", backgroundColor: "blue"}}, this.props.paragraph)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11385 次 |
| 最近记录: |