Skip to content

Commit 593764d

Browse files
committed
add Readme
1 parent 5dc4682 commit 593764d

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Vue Images Upload Component
2+
Vue component that provides drag and drop images upload with preview.
3+
4+
## Features
5+
6+
* Upload files by Drag & Drop
7+
* Upload files by clicking on the upload icon
8+
* Add images
9+
* Delete Images
10+
* Append Images
11+
12+
## Example
13+
14+
[DEMO]("https://vueupload.yudax.dev")
15+
16+
## Install
17+
18+
1. install the package:
19+
20+
```bash
21+
npm i vue-upload-drop-images --save
22+
```
23+
24+
2. import it in your project
25+
26+
.vue file:
27+
```javascript
28+
<script>
29+
import UploadImages from "vue-upload-drop-images"
30+
...
31+
export default {
32+
components: {
33+
UploadImages,
34+
},
35+
...
36+
</script>
37+
```
38+
3. add component in template
39+
```html
40+
<template>
41+
...
42+
<UploadImages />
43+
...
44+
</template>
45+
46+
```
47+
48+
## Events
49+
50+
### <b>@change</b>
51+
Fired when new images are added or deleted it always returns uploaded files
52+
53+
Template:
54+
55+
```html
56+
<UploadImages @change="handleImages"/>
57+
```
58+
59+
Script:
60+
61+
```javascript
62+
...
63+
methods:{
64+
handleImages(files){
65+
console.log(files)
66+
/*
67+
[
68+
{
69+
"name": "Screenshot from 2021-02-23 12-36-33.png",
70+
"size": 319775,
71+
"type": "image/png",
72+
"lastModified": 1614080193596
73+
...
74+
},
75+
...
76+
]
77+
*/
78+
}
79+
}
80+
...
81+
```
82+
83+
84+
85+
## Props
86+
### <b>max</b>
87+
Type: `Number`
88+
89+
Required: `false`
90+
91+
default: `null`
92+
93+
```html
94+
<!-- the user can upload up to 5 images-->
95+
<UploadImages :max="5"/>
96+
```
97+
98+
### <b>maxError</b>
99+
Type: `String`
100+
101+
Required: `false`
102+
103+
default: `Maximum files is`
104+
105+
```html
106+
<!-- the error message that the user sees when the uploaded images greater that the max images required-->
107+
<UploadImages maxError="Max files exceed"/>
108+
```
109+
110+
### <b>uploadMsg</b>
111+
Type: `String`
112+
113+
Required: `false`
114+
115+
default: `Click to upload or drop your images here`
116+
117+
```html
118+
<!-- the message that the user see to upload the images -->
119+
<UploadImages uploadMsg="upload product images"/>
120+
```
121+
122+
### <b>fileError</b>
123+
Type: `String`
124+
125+
Required: `false`
126+
127+
default: `Unsupported file type`
128+
129+
```html
130+
<!-- the message that the user see when the uploaded file is not an image -->
131+
<UploadImages fileError="images files only accepted"/>
132+
```

0 commit comments

Comments
 (0)