From d584b20dd89aca1568cac69417f8972960e17f46 Mon Sep 17 00:00:00 2001 From: Qiaosen Huang Date: Mon, 21 Mar 2016 14:16:22 +0800 Subject: [PATCH 1/2] add onPreview onRemove override on upload. --- components/upload/index.jsx | 13 ++++++++++++- components/upload/uploadList.jsx | 9 +++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/components/upload/index.jsx b/components/upload/index.jsx index 60fc2a168a..974942d795 100644 --- a/components/upload/index.jsx +++ b/components/upload/index.jsx @@ -172,11 +172,21 @@ const AntUpload = React.createClass({ } }, + handlePreview(file) { + if ('onPreview' in this.props) { + this.props.onPreview(file); + } + }, + handleManualRemove(file) { /*eslint-disable */ file.status = 'removed'; /*eslint-enable */ - this.handleRemove(file); + if ('onRemove' in this.props) { + this.props.onRemove(file); + } else { + this.handleRemove(file); + } }, onChange(info) { @@ -235,6 +245,7 @@ const AntUpload = React.createClass({ uploadList = ( ); } diff --git a/components/upload/uploadList.jsx b/components/upload/uploadList.jsx index 8afe60e951..9ee1e14109 100644 --- a/components/upload/uploadList.jsx +++ b/components/upload/uploadList.jsx @@ -28,6 +28,10 @@ export default React.createClass({ handleClose(file) { this.props.onRemove(file); }, + handlePreview(file, e) { + e.preventDefault(); + return this.props.onPreview(file); + }, componentDidUpdate() { if (this.props.listType !== 'picture' && this.props.listType !== 'picture-card') { return; @@ -65,6 +69,7 @@ export default React.createClass({ } } else { icon = ({file.name} ); @@ -87,13 +92,13 @@ export default React.createClass({
{icon} {file.url - ? {file.name} + ? {file.name} : {file.name}} { this.props.listType === 'picture-card' && file.status !== 'uploading' ? ( - + ) : From 1fd31771b3cd977f22cdc31127a8c85978b63df1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 5 Apr 2016 13:34:44 +0800 Subject: [PATCH 2/2] fix hidden demo --- components/upload/demo/multiple.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/upload/demo/multiple.md b/components/upload/demo/multiple.md index 84a0ef1e41..10ba33148f 100644 --- a/components/upload/demo/multiple.md +++ b/components/upload/demo/multiple.md @@ -1,6 +1,6 @@ --- order: 5 -hidden: 5 +hidden: true title: 多文件选择 ---