mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
update upload
This commit is contained in:
parent
e4afb5a420
commit
b6ff796e71
@ -27,5 +27,6 @@ ReactDOM.render(
|
|||||||
````css
|
````css
|
||||||
#components-upload-demo-drag-simple {
|
#components-upload-demo-drag-simple {
|
||||||
width: 246px;
|
width: 246px;
|
||||||
|
height: 146px;
|
||||||
}
|
}
|
||||||
````
|
````
|
||||||
|
@ -27,3 +27,9 @@ ReactDOM.render(
|
|||||||
document.getElementById('components-upload-demo-drag')
|
document.getElementById('components-upload-demo-drag')
|
||||||
);
|
);
|
||||||
````
|
````
|
||||||
|
|
||||||
|
````css
|
||||||
|
#components-upload-demo-drag {
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
````
|
||||||
|
@ -180,15 +180,9 @@ const AntUpload = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onFileDrop(e) {
|
onFileDrop(e) {
|
||||||
if (e.type === 'dragover') {
|
this.setState({
|
||||||
this.setState({
|
dragState: e.type
|
||||||
dragState: 'dragover'
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
dragState: 'drop'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
clearProgressTimer() {
|
clearProgressTimer() {
|
||||||
clearInterval(this.progressTimer);
|
clearInterval(this.progressTimer);
|
||||||
@ -206,37 +200,38 @@ const AntUpload = React.createClass({
|
|||||||
uploadList = <UploadList items={this.state.fileList} onRemove={this.handleManualRemove} />;
|
uploadList = <UploadList items={this.state.fileList} onRemove={this.handleManualRemove} />;
|
||||||
}
|
}
|
||||||
if (type === 'drag') {
|
if (type === 'drag') {
|
||||||
let dragUploadingClass = '';
|
let dragUploadingClass = this.state.fileList.some((file) => {
|
||||||
let fileList = this.state.fileList;
|
return file.status === 'uploading';
|
||||||
const dragState = this.state.dragState;
|
}) ? `${prefixCls}-drag-uploading` : '';
|
||||||
for (let i = 0; i < fileList.length; i ++) {
|
|
||||||
if (fileList[i].status === 'uploading') {
|
let draggingClass = this.state.dragState === 'dragover'
|
||||||
dragUploadingClass = ` ${prefixCls}-drag-uploading ${dragState === 'drop' ? '' : `${prefixCls}-drag-hover`}`;
|
? `${prefixCls}-drag-hover` : '';
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div className={prefixCls + ' ' + prefixCls + '-drag-area'} onDrop={this.onFileDrop} onDragOver={this.onFileDrop}>
|
<span>
|
||||||
<div className={prefixCls + ' ' + prefixCls + '-drag' + dragUploadingClass}>
|
<div className={prefixCls + ' ' + prefixCls + '-drag '
|
||||||
|
+ dragUploadingClass + ' ' + draggingClass}
|
||||||
|
onDrop={this.onFileDrop}
|
||||||
|
onDragOver={this.onFileDrop}
|
||||||
|
onDragLeave={this.onFileDrop}>
|
||||||
<Upload {...props}>
|
<Upload {...props}>
|
||||||
<div className={prefixCls + '-drag-container'}>
|
<div className={prefixCls + '-drag-container'}>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</div>
|
</div>
|
||||||
</Upload>
|
</Upload>
|
||||||
</div>
|
</div>
|
||||||
{ uploadList }
|
{uploadList}
|
||||||
</div>
|
</span>
|
||||||
);
|
);
|
||||||
} else if (type === 'select') {
|
} else if (type === 'select') {
|
||||||
return (
|
return (
|
||||||
<div>
|
<span>
|
||||||
<div className={prefixCls + ' ' + prefixCls + '-select'}>
|
<div className={prefixCls + ' ' + prefixCls + '-select'}>
|
||||||
<Upload {...props}>
|
<Upload {...props}>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</Upload>
|
</Upload>
|
||||||
</div>
|
</div>
|
||||||
{ uploadList }
|
{uploadList}
|
||||||
</div>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
"rc-tooltip": "~3.1.0",
|
"rc-tooltip": "~3.1.0",
|
||||||
"rc-tree": "~0.18.1",
|
"rc-tree": "~0.18.1",
|
||||||
"rc-trigger": "~1.0.6",
|
"rc-trigger": "~1.0.6",
|
||||||
"rc-upload": "~1.6.4",
|
"rc-upload": "~1.7.0",
|
||||||
"rc-util": "~3.0.1",
|
"rc-util": "~3.0.1",
|
||||||
"react-slick": "~0.9.1",
|
"react-slick": "~0.9.1",
|
||||||
"reqwest": "~2.0.5",
|
"reqwest": "~2.0.5",
|
||||||
|
@ -17,16 +17,16 @@
|
|||||||
|
|
||||||
&.@{upload-prefix-cls}-drag {
|
&.@{upload-prefix-cls}-drag {
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
transition: all 0.3s ease;
|
transition: border-color 0.3s ease;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: @border-radius-base;
|
border-radius: @border-radius-base;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 180px;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&.@{upload-prefix-cls}-drag-hover {
|
&.@{upload-prefix-cls}-drag-hover {
|
||||||
border-color: tint(@primary-color, 20%);
|
border: 2px dashed tint(@primary-color, 20%);
|
||||||
}
|
}
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
|
Loading…
Reference in New Issue
Block a user