1 | # Upload Button
|
2 |
|
3 | ### Basic usage
|
4 |
|
5 | :::kview
|
6 |
|
7 | ```html
|
8 | <template>
|
9 | <k-upload-btn />
|
10 | </template>
|
11 |
|
12 | <script>
|
13 |
|
14 | export default {
|
15 | data() {
|
16 | return {
|
17 | }
|
18 | },
|
19 | methods: {
|
20 |
|
21 | },
|
22 | };
|
23 |
|
24 | </script>
|
25 | ```
|
26 |
|
27 | :::
|
28 |
|
29 | ## Props
|
30 | <div class="markdown-table">
|
31 |
|
32 | | Attribute | Description | Type | Default| Require |
|
33 | |-------|---------|------|--------|----------|
|
34 | |multiple|whether uploading multiple files is permitted|Boolean|false|-
|
35 | |headers|request headers|Object|-|-
|
36 | |fileName|key name for uploaded file|String|file|-
|
37 | |data|additions options of request|Object|-|-
|
38 | |url|request URL|String|-|true
|
39 | |withCredentials|whether cookies are sent|Boolean|false|-
|
40 | |beforeUpload|hook function before uploading with the file to be uploaded as its parameter. If false is returned or a Promise is returned and then is rejected, uploading will be aborted; Paramters:(fileName : string, file : File)|Function|-|-
|
41 | |onProgress|hook function when some progress occurs; Paramters:(e : Event, file : File, fileList : Array\<File\>)|Function|-|-
|
42 | |onSuccess|hook function when uploaded successfully; Paramters:(res : Result, file : File, fileList : Array\<File\>)|Function|-|-
|
43 | |onError|hook function when some errors occurs; Paramters:(err : Error, res:result, file : File, fileList : Array\<File\>)|Function|-|-
|
44 |
|
45 | </div>
|
46 |
|
47 |
|