Fix default upload item link, close #2331

This commit is contained in:
afc163 2016-07-09 17:22:48 +08:00
parent fc9eacbd7e
commit 0977a656aa
2 changed files with 5 additions and 9 deletions

View File

@ -188,12 +188,6 @@ export default class Upload extends React.Component {
}
}
handlePreview = (file) => {
if ('onPreview' in this.props) {
this.props.onPreview(file);
}
}
handleManualRemove = (file) => {
/*eslint-disable */
file.status = 'removed';
@ -245,7 +239,7 @@ export default class Upload extends React.Component {
uploadList = (
<UploadList listType={this.props.listType}
items={this.state.fileList}
onPreview={this.handlePreview}
onPreview={props.onPreview}
onRemove={this.handleManualRemove}
/>
);

View File

@ -27,8 +27,10 @@ export default class UploadList extends React.Component {
}
handlePreview = (file, e) => {
e.preventDefault();
return this.props.onPreview(file);
if (this.props.onPreview) {
e.preventDefault();
return this.props.onPreview(file);
}
}
componentDidUpdate() {