Skip to content

Commit

Permalink
docs: add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
madocto committed Jan 20, 2024
1 parent bc718b0 commit 216baf7
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/demo/paste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: paste
nav:
title: Demo
path: /demo
---

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

const props = {
action: '/upload.do',
type: 'drag',
accept: '.png',
beforeUpload(file) {
console.log('beforeUpload', file.name);
},
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' },
};

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

export default Test;

0 comments on commit 216baf7

Please sign in to comment.