Skip to content

Commit

Permalink
feat: 添加dragDirectory拖拽上传文件夹demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mansion-sun committed Jun 13, 2024
1 parent f424d38 commit aa5264f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/demo/dragDirectory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: dragDirectory
nav:
title: Demo
path: /demo
---

<code src="../examples/dragDirectory.tsx"/></code>
44 changes: 44 additions & 0 deletions docs/examples/dragDirectory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* eslint no-console:0 */
import React from 'react';
import Upload from 'rc-upload';

const props = {
action: '/upload.do',
type: 'drag',
directory: true,
beforeUpload(file, fileList) {
console.log('beforeUpload', file.name, fileList);
},
onStart: file => {
console.log('onStart', file.name);
},
onSuccess(file) {
console.log('onSuccess', file);
},
onProgress(step, file) {
console.log('onProgress', Math.round(step.percent), file.name);
},
onError(err) {
console.log('onError', err);
},
style: { display: 'inline-block', width: 200, height: 200, background: '#eee' },
// openFileDialogOnClick: false
};

const Test = () => {
return (
<div
style={{
margin: 100,
}}
>
<div>
<Upload {...props}>
<a>开始上传</a>
</Upload>
</div>
</div>
);
};

export default Test;

0 comments on commit aa5264f

Please sign in to comment.