Skip to content

injectTapEventPlugin

司徒正美 edited this page Jul 6, 2017 · 1 revision
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <style>
      
    </style>
    </style>
     <script type='text/javascript' src="./libs/polyfill.js"></script>
     <script type='text/javascript' src="./dist/React.js"></script>
     <script type='text/javascript' src="./libs/injectTapEventPlugin.js"></script>
     <script type='text/javascript' src="./libs/babel.js"></script>
  <script type='text/babel'>
  
  window.onload = function(){
  
    class App extends React.Component {
      constructor(props) {
        super(props);
        this.state = {
          aaa: 1111
        };
      }
      onChange(){
         this.setState({
           aaa: new Date - 0
         })
      }
      componentWillMount() {
        this.state = {
            aaa: 333
        }
        this.forceUpdate( function(){
          
          console.log('forceUpdate')
        });
      }
      render() {
        return <p onTouchTap={this.onChange.bind(this)}>{this.state.aaa}</p>;
      }
    }

    var s = ReactDOM.render(<App />, document.getElementById('example'));
  }
  </script>

</head>

<body>

    <div>开发者工具</div>
    <div id='example'></div>

<div id='aaa'></div>

</body>

</html>