diff --git a/examples/basic/client.js b/examples/basic/client.js index 9252902..80a5a79 100644 --- a/examples/basic/client.js +++ b/examples/basic/client.js @@ -1,6 +1,7 @@ var React = require('react'); var ReactDOM = require('react-dom'); var FileUploader = require('../../lib'); +var _ = require('lodash'); var MyComponent = React.createClass({ getInitialState: function() { @@ -30,7 +31,7 @@ var MyComponent = React.createClass({ //} }, - onFileDrop: function(target, files) { + onFileDrop: function({ target }, files) { let node = ReactDOM.findDOMNode(this.refs.uploadPanel); if (target != node) { return false; @@ -51,6 +52,20 @@ var MyComponent = React.createClass({ this.closePanel(); }, + onFileProgress: function(file) { + var files = this.state.files; + + files.map(function(_file) { + if (_file.id === file.id) { + _file = file; + } + }); + + this.setState({ + files: files + }); +}, + onFileUpdate: function(file) { var files = this.state.files; @@ -106,36 +121,39 @@ var MyComponent = React.createClass({ }
-Upload List
- { - this.state.files.map(function(file, index) { - return ( -