用URL和类反应img标签问题

用URL和类反应img标签问题,第1张

用URL和类反应img标签问题

请记住,您的img实际上不是DOM元素,而是Javascript表达式

  1. 这是一个JSX属性表达式。将大括号放在src字符串表达式周围,它将起作用。参见http://facebook.github.io/react/docs/jsx-in-depth.html#attribute-expressions

  2. 在javascript中,class属性是使用className的引用。请参阅本节中的注释:http : //facebook.github.io/react/docs/jsx-in-depth.html#react-composite-components

            var Hello = React.createClass({        render: function() { return <div><img src={'http://placehold.it/400x20&text=slide1'} alt="boohoo" className="img-responsive"/><span>Hello {this.props.name}</span></div>;        }    });    React.renderComponent(<Hello name="World" />, document.body);


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5642248.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存