Skip to content

Commit 6c0336c

Browse files
author
‘xiuxiu-yang’
committed
feat(playground): add upload playground
1 parent eb11d2f commit 6c0336c

File tree

2 files changed

+56
-3
lines changed

2 files changed

+56
-3
lines changed

playground/src/views/Upload.vue

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,54 @@
11
<script setup lang="ts">
2+
import { LButton, LUpload } from 'lucky-design'
3+
4+
const onSuccess = (res: any) => {
5+
// console.log(res)
6+
}
7+
const onProgress = (ev: ProgressEvent<XMLHttpRequestEventTarget>) => {
8+
// console.log(ev)
9+
}
10+
11+
const beforeUpload = (file: File) => {
12+
// console.log(file)
13+
return Promise.resolve()
14+
}
215
</script>
316

417
<template>
518
<div>
6-
<div>upload</div>
19+
<div>
20+
<p>
21+
<LUpload
22+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
23+
name="file"
24+
:on-success="onSuccess"
25+
:on-progress="onProgress"
26+
>
27+
<LButton text="上传" type="primary" />
28+
</LUpload>
29+
</p>
30+
<p>
31+
<LUpload
32+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
33+
name="file"
34+
:multiple="true"
35+
:on-success="onSuccess"
36+
:on-progress="onProgress"
37+
>
38+
<LButton text="上传" type="primary" />
39+
</LUpload>
40+
</p>
41+
<p>
42+
<LUpload
43+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
44+
name="file"
45+
:before-upload="beforeUpload"
46+
:on-success="onSuccess"
47+
:on-progress="onProgress"
48+
>
49+
<LButton text="上传" type="primary" />
50+
</LUpload>
51+
</p>
52+
</div>
753
</div>
854
</template>

playground/src/vite-env.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
declare module 'lucky-design' {
2-
import { LButton, LCheckbox, LDrawer, LMessage, LTree } from 'lucky-design'
3-
export { LButton, LCheckbox, LDrawer, LMessage, LTree }
2+
import {
3+
LButton,
4+
LCheckbox,
5+
LDrawer,
6+
LMessage,
7+
LTree,
8+
LUpload,
9+
} from 'lucky-design'
10+
export { LButton, LCheckbox, LDrawer, LMessage, LTree, LUpload }
411
}

0 commit comments

Comments
 (0)