<div dangerouslySetInnerHTML={{__html: '<h3>this is content</h3>'}}></div>
这个可以将带有html的字符串转变成dom节点,后台传来的字符一定要是未转义的
let str = "<h3>this is content</h3>"
//显示
<div dangerouslySetInnerHTML={{__html: str}}></div>
<div dangerouslySetInnerHTML={{__html: '<h3>this is content</h3>'}}></div>
这个可以将带有html的字符串转变成dom节点,后台传来的字符一定要是未转义的
let str = "<h3>this is content</h3>"
//显示
<div dangerouslySetInnerHTML={{__html: str}}></div>