@@ -4,32 +4,27 @@ import React from 'react';
44import ReactDOM from 'react-dom' ;
55import Upload from 'rc-upload' ;
66
7- class Test extends React . Component {
8- render ( ) {
9- const props = {
10- action : '/upload.do' ,
11- type : 'drag' ,
12- accept : '.png' ,
13- beforeUpload ( file ) {
14- console . log ( 'beforeUpload' , file . name ) ;
15- } ,
16- onStart : ( file ) => {
17- console . log ( 'onStart' , file . name ) ;
18- } ,
19- onSuccess ( file ) {
20- console . log ( 'onSuccess' , file ) ;
21- } ,
22- onProgress ( step , file ) {
23- console . log ( 'onProgress' , Math . round ( step . percent ) , file . name ) ;
24- } ,
25- onError ( err ) {
26- console . log ( 'onError' , err ) ;
27- } ,
28- style : { display : 'inline-block' , width : 200 , height : 200 , background : '#eee' } ,
29- // openFileDialogOnClick: false
30- } ;
31- return < Upload { ...props } /> ;
32- }
33- }
7+ const props = {
8+ action : '/upload.do' ,
9+ type : 'drag' ,
10+ accept : '.png' ,
11+ beforeUpload ( file ) {
12+ console . log ( 'beforeUpload' , file . name ) ;
13+ } ,
14+ onStart : ( file ) => {
15+ console . log ( 'onStart' , file . name ) ;
16+ } ,
17+ onSuccess ( file ) {
18+ console . log ( 'onSuccess' , file ) ;
19+ } ,
20+ onProgress ( step , file ) {
21+ console . log ( 'onProgress' , Math . round ( step . percent ) , file . name ) ;
22+ } ,
23+ onError ( err ) {
24+ console . log ( 'onError' , err ) ;
25+ } ,
26+ style : { display : 'inline-block' , width : 200 , height : 200 , background : '#eee' } ,
27+ // openFileDialogOnClick: false
28+ } ;
3429
35- ReactDOM . render ( < Test /> , document . getElementById ( '__react-content' ) ) ;
30+ ReactDOM . render ( < Upload { ... props } /> , document . getElementById ( '__react-content' ) ) ;
0 commit comments