reactjs能否正常使用IE8?我正在使用React v0.11.1。reactJS与IE8无法正常工作
以下代码不适用于IE8。适用于所有其他浏览器精细
SCRIPT438:对象不支持属性或方法 'IsArray的' 文件:react.js,行:17372,列:37 SCRIPT5009: '阵营' 是未定义 文件:myreact .js文件,行:3列:1 SCRIPT438:对象不支持属性或方法 '地图' 文件:JSXTransformer.js,行:12637,列:3
/** @jsx React.DOM */
var MyComponent = React.createClass({displayName: 'MyComponent',
getDefaultProps:function(){
return{
text:"",
numbers:0
}
},
getInitialState:function(){
return {txt:"initial", id:0}
},
updateText: function(event){
this.setState({text:event.target.value})
},
propTypes:{
text:React.PropTypes.string,
numbers: React.PropTypes.number.isRequired
},
render:function(){
return (
React.DOM.div(null,
Widget({text: this.state.text, update: this.updateText}),
Widget({text: this.state.text, update: this.updateText})
)
)
}
});
var Widget = React.createClass({displayName: 'Widget', render:function(){
return(
React.DOM.div(null,
React.DOM.input({type: "text", onChange: this.props.update}),
React.DOM.div(null, this.props.text)
)
)
}
});
React.renderComponent(
MyComponent({text: "HI there", numbers: 34}),
document.getElementById("content")
);
可能重复[为什么IE8在使用Facebook的React.js时得到脚本错误](http://stackoverflow.com/questions/19259427/why-is-ie8-getting-a-script -error-when-using-facebooks-react-js) – chiccodoro 2014-09-26 08:00:37
http://facebook.github.io/react/docs/working-with-the-browser.html#browser-support-and-polyfills – David 2014-09-26 10:49:15
感谢您的评论,我包括es5Shim.js和es5Sham.js。现在它工作正常。 – rishinarang 2014-09-26 11:39:11