接收后端传来的一段 img标签时
天真的以为这样就行了。
<div className={styles.content_img} > {this.props.myCode} </div>
结果没想到在我接收到这段img的时候他已经变成了字符串了emm
所以页面是成了这样。。。。。
然后我在react文档上就发现了这个
dangerouslySetInnerHTML
https://zh-hans.reactjs.org/docs/dom-elements.html
<div className={styles.content_img} dangerouslySetInnerHTML={{ __html: this.props.myCode}}>
</div>
完美解决,哈哈哈。