<html> <head> <title></title> <meta charset="UTF-8"/> <script src="js/react.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/react-dom.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/browser.min.js" type="text/javascript" charset="utf-8"></script> <style type="text/css"> .borderstyle{ border: 1px solid #ccc; width: 12%; } </style> </head> <body> <div id="container"></div> </body> <script type="text/babel"> var Crud = React.createClass({ render:function(){ return ( <div className="borderstyle"> <div>{this.props.children}</div> <button>编辑</button> <button>删除</button> </div> ); } }); ReactDOM.render( <div> <Crud>Hello world</Crud> </div>, document.getElementById(‘container‘) ); </script> </html>
this.props.children获取值
时间: 2024-11-09 03:05:35