|
|
@ -28,18 +28,16 @@ You can gain full control over filelist by configuring `fileList`. You can accom |
|
|
|
````jsx |
|
|
|
import { Upload, Button, Icon } from 'antd'; |
|
|
|
|
|
|
|
const MyUpload = React.createClass({ |
|
|
|
getInitialState() { |
|
|
|
return { |
|
|
|
fileList: [{ |
|
|
|
uid: -1, |
|
|
|
name: 'xxx.png', |
|
|
|
status: 'done', |
|
|
|
url: 'http://www.baidu.com/xxx.png', |
|
|
|
}], |
|
|
|
}; |
|
|
|
}, |
|
|
|
handleChange(info) { |
|
|
|
class MyUpload extends React.Component { |
|
|
|
state = { |
|
|
|
fileList: [{ |
|
|
|
uid: -1, |
|
|
|
name: 'xxx.png', |
|
|
|
status: 'done', |
|
|
|
url: 'http://www.baidu.com/xxx.png', |
|
|
|
}], |
|
|
|
} |
|
|
|
handleChange = (info) => { |
|
|
|
let fileList = info.fileList; |
|
|
|
|
|
|
|
// 1. Limit the number of uploaded files |
|
|
@ -64,7 +62,7 @@ const MyUpload = React.createClass({ |
|
|
|
}); |
|
|
|
|
|
|
|
this.setState({ fileList }); |
|
|
|
}, |
|
|
|
} |
|
|
|
render() { |
|
|
|
const props = { |
|
|
|
action: '/upload.do', |
|
|
@ -78,8 +76,8 @@ const MyUpload = React.createClass({ |
|
|
|
</Button> |
|
|
|
</Upload> |
|
|
|
); |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ReactDOM.render(<MyUpload />, mountNode); |
|
|
|
```` |
|
|
|