├── demo.gif ├── package.json ├── LICENSE ├── README.md └── dist └── vue-upload-drop-images.vue /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudax42/vue-upload-drop-images/HEAD/demo.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-upload-drop-images", 3 | "version": "1.0.7", 4 | "description": "Vue component that provides drag and drop images upload with preview", 5 | "main": "dist/vue-upload-drop-images.vue", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/yudax42/vue-upload-drop-images" 9 | }, 10 | "keywords": [ 11 | "vue-image-upload", 12 | "vue.js image uploader with preview", 13 | "drag drop image", 14 | "upload multiple images with preview", 15 | "component", 16 | "vue-component", 17 | "vue-upload-drop-images" 18 | ], 19 | "author": { 20 | "name": "yudax42", 21 | "email": "yudax42@gmail.com" 22 | }, 23 | "license": "MIT", 24 | "homepage": "https://github.com/yudax42/vue-upload-drop-images", 25 | "dependencies": {} 26 | } 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Youssef 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vue Images Upload Component 2 | Vue component that provides drag and drop images upload with preview. 3 | 4 |  5 | 6 |  7 | 8 | ## Features 9 | 10 | * Upload files by Drag & Drop 11 | * Upload files by clicking on the upload icon 12 | * Add images 13 | * Delete Images 14 | * Append Images 15 | * Remove all images 16 | 17 | ## Example 18 | 19 | [DEMO](https://vueupload.yudax.dev) 20 | 21 | ## Install 22 | 23 | 1. install the package: 24 | 25 | ```bash 26 | npm i vue-upload-drop-images --save 27 | ``` 28 | 29 | 2. import it in your project 30 | 31 | .vue file: 32 | ```javascript 33 | 42 | ``` 43 | 44 | 3. add component in template 45 | ```html 46 | 47 | ... 48 | 49 | ... 50 | 51 | 52 | ``` 53 | 54 | 4. for Nuxt support 55 | .nuxt.config: 56 | ```javascript 57 | build: { 58 | transpile: ['vue-upload-drop-images'] 59 | } 60 | ``` 61 | 62 | ## Events 63 | 64 | ### @changed 65 | Fired when new images are added or deleted it always returns uploaded files 66 | 67 | Template: 68 | 69 | ```html 70 | 71 | ``` 72 | 73 | Script: 74 | 75 | ```javascript 76 | ... 77 | methods:{ 78 | handleImages(files){ 79 | console.log(files) 80 | /* 81 | [ 82 | { 83 | "name": "Screenshot from 2021-02-23 12-36-33.png", 84 | "size": 319775, 85 | "type": "image/png", 86 | "lastModified": 1614080193596 87 | ... 88 | }, 89 | ... 90 | ] 91 | */ 92 | } 93 | } 94 | ... 95 | ``` 96 | 97 | 98 | 99 | ## Props 100 | ### max 101 | Type: `Number` 102 | 103 | Required: `false` 104 | 105 | default: `null` 106 | 107 | ```html 108 | 109 | 110 | ``` 111 | 112 | ### maxError 113 | Type: `String` 114 | 115 | Required: `false` 116 | 117 | default: `Maximum files is` 118 | 119 | ```html 120 | 121 | 122 | ``` 123 | 124 | ### uploadMsg 125 | Type: `String` 126 | 127 | Required: `false` 128 | 129 | default: `Click to upload or drop your images here` 130 | 131 | ```html 132 | 133 | 134 | ``` 135 | 136 | ### fileError 137 | Type: `String` 138 | 139 | Required: `false` 140 | 141 | default: `Unsupported file type` 142 | 143 | ```html 144 | 145 | 146 | ``` 147 | 148 | ### clearAll 149 | Type: `String` 150 | 151 | Required: `false` 152 | 153 | default: `clear All` 154 | 155 | ```html 156 | 157 | 158 | ``` 159 | -------------------------------------------------------------------------------- /dist/vue-upload-drop-images.vue: -------------------------------------------------------------------------------- 1 | 104 | 105 | 106 | 112 | 113 | 114 | 115 | {{ error }} 116 | 117 | 118 | 119 | 120 | 128 | 129 | Upload Image 130 | 131 | 132 | 133 | 134 | 147 | 148 | 159 | 173 | 174 | 175 | 186 | 197 | 210 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | {{ uploadMsg ? uploadMsg : "Click to upload or drop your images here" }} 228 | 229 | 230 | 231 | 232 | {{ clearAll ? clearAll : "clear All" }} 233 | 234 | 235 | 236 | 237 | 244 | 250 | 251 | 252 | + 253 | 254 | 255 | 256 | 257 | 258 | --------------------------------------------------------------------------------
227 | {{ uploadMsg ? uploadMsg : "Click to upload or drop your images here" }} 228 |