Twitter bootstrap 引导。使用react道具可以很好地改变颜色
我正在使用bootstrap&reactjs。 我的页面上有一个.well组件。用户应该能够更改其颜色。颜色存储在{this.props.Color}中。 我正试图这样改变它: 在代码中使用了“this.props.color”,这是一个普通字符串。 应改为:Twitter bootstrap 引导。使用react道具可以很好地改变颜色,twitter-bootstrap,reactjs,Twitter Bootstrap,Reactjs,我正在使用bootstrap&reactjs。 我的页面上有一个.well组件。用户应该能够更改其颜色。颜色存储在{this.props.Color}中。 我正试图这样改变它: 在代码中使用了“this.props.color”,这是一个普通字符串。 应改为: style={{backgroundColor: this.props.color}} 顺便说一下,您最好将所有样式特性放在同一个对象中: <div className="well lead" style={{backgrou
style={{backgroundColor: this.props.color}}
顺便说一下,您最好将所有样式特性放在同一个对象中:
<div className="well lead" style={{backgroundColor: this.props.color, marginTop:'20px'}} >
非常感谢。你的第二个通知很重要。我以前尝试过删除“{}”,但只有在将样式属性放在一个对象中时,它才起作用