当我在下面运行代码时
控制台显示:
Uncaught TypeError: Cannot read property 'component' of undefined
但测试代码可以显示:
ReactDOM.findDOMNode(this.refs.component).innerText = 'ddd';
有什么问题?
var reader = new FileReader();
reader.onload = function(e) {
console.log('onload: ' + e.target.result);
ReactDOM.findDOMNode(this.refs.component).innerText = e.target.result;
}
reader.onerror = function(stuff) {
console.log("error", stuff);
console.log (stuff.getMessage());
}
ReactDOM.findDOMNode(this.refs.component).innerText = 'ddd';
console.log('readAsText:' + reader.readAsText(data[0]));