默认情况下,React Render不允许插入html标签的,为了避免xss攻击
<div className='body'>
{this.props.description}
</div>
所以上面默认情况下你这样使用都是不能显示换行功能的:
confirm('Are you sure?', {
description: '遇到点问题!<br/>请尝试下载(更新)新版点融APP,并在投资页面使用该券。'
});
or
confirm('Are you sure?', {
description: '遇到点问题!\n请尝试下载(更新)新版点融APP,并在投资页面使用该券。'
});
解决方案,需要开启html显示功能:
<div className='modal-body' dangerouslySetInnerHTML={{__html: this.props.description}}></div>
这样的话,你的html标签(换行)就可以正常显示了。
有疑问或技术交流,扫描公众号一起讨论学习。
更多React在线学习访问:http://each.sinaapp.com/react/index.html

3297

被折叠的 条评论
为什么被折叠?



