码迷,mamicode.com
首页 > Web开发 > 详细

React-非dom属性-dangerouslySetInnerHTML标签

时间:2015-12-16 21:12:26      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <script src="./react-0.13.2/build/react.js"></script>
    <script src="./react-0.13.2/build/JSXTransformer.js"></script>
	<script type="text/jsx">
		var style = {
			color : "red",
			border: "1px #000 solid",
		};
		var HelloWorld = React.createClass({
			render: function(){
				return <p>你好React</p>;
			}
		});
		var rawHTML = {
			__html: "<h2>非dom属性:dangerouslySetInnerHTML标签</h2>"
		};
		React.render(<div style={style} dangerouslySetInnerHTML={rawHTML}></div>, document.body);
	</script>
</body>

</html>

  技术分享

React-非dom属性-dangerouslySetInnerHTML标签

标签:

原文地址:http://www.cnblogs.com/shamgod/p/5052312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!