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 8dca549 commit 3dafa44
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 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>
3 changes: 2 additions & 1 deletion playground/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare module 'lucky-design' {
LMessage,
LTree,
LBacktop,
LUpload,
} from 'lucky-design'
export { LButton, LCheckbox, LDrawer, LMessage, LTree, LBacktop }
export { LButton, LCheckbox, LDrawer, LMessage, LTree, LBacktop, LUpload }
}

0 comments on commit 3dafa44

Please sign in to comment.