最佳答案
我想呈现一个 <select>
输入的 HTML5属性,这样我就可以使用 jquery 图像选择器进行响应。我的代码是:
var Book = React.createClass({
render: function() {
return (
<option data-img-src="{this.props.imageUrl}" value="1">{this.props.title}</option>
问题是,即使 {this.props.imageUrl}
作为 prop
正确地传递,它也不是在 HTML 中呈现的——它只是作为 {this.props.imageUrl}
呈现。如何使变量正确地传递到 HTML 中?