Skip to content

ReactIE的使用

司徒正美 edited this page Aug 20, 2019 · 2 revisions

ReactIE下多暴露了一个miniCreateClass方法

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
   <script src="./lib/polyfill.js"></script>
  <script src="./dist/ReactIE.js"></script>
  <script>
      console.log('...............')
      window.onload = function(){
        function App(){
            this.state = {
                value: ""
            }
            console.log("xxxx")
            var that = this
            this.onChange = function(e) {
                var value = e.target.value;
                that.setState({value: value})
            }
        }
        var h = React.createElement;
         App =  React.miniCreateClass(App,React.Component, {     
            render: function(){
                return h("div", null, h("input", {type: 'number',value: this.state.value.toUpperCase(), onChange: this.onChange}), this.state.value.toUpperCase())
            }
        },{})

ReactDOM.render(h(App), document.getElementById('root'))
      }
 
  </script>
</head>
<body>
  <div id="root"></div>
</body>
</html>