<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="js/react.js"></script> <script src="js/react-dom.js"></script> <script src="js/browser.min.js"></script> </head> <body> <div id="example_1"></div> <div id="example_2"></div> <script type="text/babel"> var GreetMessage = React.createClass({ getInitialState:function(){ return {value:0,listDom:[<li>{this.value}</li>]}; }, handleClick:function(){ var _this = this; this.state.listDom.push(<li>{_this.state.value}</li>); this.setState({value:this.state.value+1}); }, render:function(){ var list = this.state.listDom.map(function(li){ return li }) return (<ul> {list} </ul>) } }); ReactDOM.render(<GreetMessage/>,document.getElementById("example_1")); </script>
这是错哪了?
付费偷看金额在0.1-10元之间
一周热门 更多>