Skip to content

Commit

Permalink
feat(playground): add upload playground
Browse files Browse the repository at this point in the history
  • Loading branch information
‘xiuxiu-yang’ committed Feb 13, 2023
1 parent eb11d2f commit 6c0336c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
48 changes: 47 additions & 1 deletion playground/src/views/Upload.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
<script setup lang="ts">
import { LButton, LUpload } from 'lucky-design'
const onSuccess = (res: any) => {
// console.log(res)
}
const onProgress = (ev: ProgressEvent<XMLHttpRequestEventTarget>) => {
// console.log(ev)
}
const beforeUpload = (file: File) => {
// console.log(file)
return Promise.resolve()
}
</script>

<template>
<div>
<div>upload</div>
<div>
<p>
<LUpload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
name="file"
:on-success="onSuccess"
:on-progress="onProgress"
>
<LButton text="上传" type="primary" />
</LUpload>
</p>
<p>
<LUpload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
name="file"
:multiple="true"
:on-success="onSuccess"
:on-progress="onProgress"
>
<LButton text="上传" type="primary" />
</LUpload>
</p>
<p>
<LUpload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
name="file"
:before-upload="beforeUpload"
:on-success="onSuccess"
:on-progress="onProgress"
>
<LButton text="上传" type="primary" />
</LUpload>
</p>
</div>
</div>
</template>
11 changes: 9 additions & 2 deletions playground/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
declare module 'lucky-design' {
import { LButton, LCheckbox, LDrawer, LMessage, LTree } from 'lucky-design'
export { LButton, LCheckbox, LDrawer, LMessage, LTree }
import {
LButton,
LCheckbox,
LDrawer,
LMessage,
LTree,
LUpload,
} from 'lucky-design'
export { LButton, LCheckbox, LDrawer, LMessage, LTree, LUpload }
}

0 comments on commit 6c0336c

Please sign in to comment.