From aa5264f21b1f5e305f77ffce447d7200a8daed2c Mon Sep 17 00:00:00 2001 From: sunxia Date: Thu, 13 Jun 2024 09:39:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0dragDirectory?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/demo/dragDirectory.md | 8 ++++++ docs/examples/dragDirectory.tsx | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 docs/demo/dragDirectory.md create mode 100644 docs/examples/dragDirectory.tsx diff --git a/docs/demo/dragDirectory.md b/docs/demo/dragDirectory.md new file mode 100644 index 00000000..63767ab6 --- /dev/null +++ b/docs/demo/dragDirectory.md @@ -0,0 +1,8 @@ +--- +title: dragDirectory +nav: + title: Demo + path: /demo +--- + + diff --git a/docs/examples/dragDirectory.tsx b/docs/examples/dragDirectory.tsx new file mode 100644 index 00000000..487e323f --- /dev/null +++ b/docs/examples/dragDirectory.tsx @@ -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 ( +
+
+ + 开始上传 + +
+
+ ); +}; + +export default Test;