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