Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

我用react开发的时候,想从父组件传iconfont的值给子组件,结果发现

<div>{this.props.icon}</div>

可以正常显示icon

<div> {this.props.menus[0].icon}</div>

却无法显示icon,只能显示,这一串编码,这时为什么,就是什么导致浏览器识别不了开头的编码

clipboard.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
424 views
Welcome To Ask or Share your Answers For Others

1 Answer

原来原因是reactjs出于安全考虑,会强制对所有字符进行转义


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...