Leanote's Blog
I love Leanote!
Toggle navigation
Leanote's Blog
Home
Chrome
Git
Linux
Windows
Others
工具大全
VsCode
Expo
Html
JavaScript
Npm
Node
Mock
React-Native
React
TypeScript
小程序
插件
正则
Dva
Ant-Design-React
Umi
Vue
Vux
Ant-Design-Vue
Http
Java
flutter
开发小工具
About Me
Archives
Tags
react中将html字符串渲染到页面
2019-11-14 07:46:24
39
0
0
admin
## 在做`react`项目时,有时候需要将后台传过来的`html`的字符串变成真正的结构渲染到页面,如果直接插入的话页面显示的就是这段字符串,而不会进行`转义`,可以用以下方法插入,便可以html的形式展现: ``` <div dangerouslySetInnerHTML={{__html: "<p>这里是自己要渲染的数据内容</p >"}} /> ```
Pre:
react ref(父组件访问子组件, 除了props)
Next:
react常用npm插件
0
likes
39
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.