Gathering detailed insights and metrics for crawlab-vue3-dropzone
Gathering detailed insights and metrics for crawlab-vue3-dropzone
npm install crawlab-vue3-dropzone
Typescript
Module System
Node Version
NPM Version
57.1
Supply Chain
98.5
Quality
75.3
Maintenance
100
Vulnerability
99.6
License
TypeScript (95.09%)
JavaScript (4.91%)
Total Downloads
2,542
Last Day
2
Last Week
6
Last Month
47
Last Year
1,232
102 Stars
40 Commits
16 Forks
4 Watching
4 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
3.0.3
Package Id
crawlab-vue3-dropzone@3.0.3
Unpacked Size
67.90 kB
Size
18.56 kB
File Count
12
NPM Version
6.14.17
Node Version
14.20.0
Cumulative downloads
Total Downloads
Last day
100%
2
Compared to previous day
Last week
-57.1%
6
Compared to previous week
Last month
-53.9%
47
Compared to previous month
Last year
36.7%
1,232
Compared to previous year
2
1
It's inspired by react-dropzone and implemented with vue3.
npm install --save vue3-dropzone
or
yarn add vue3-dropzone
Basic use with flexibility. acceptFiles
is an array returned in the same format as FileList where all the dropped files are turned into a File class before saving to the array.
1<template> 2 <div> 3 <div v-bind="getRootProps()"> 4 <input v-bind="getInputProps()" /> 5 <p v-if="isDragActive">Drop the files here ...</p> 6 <p v-else>Drag 'n' drop some files here, or click to select files</p> 7 </div> 8 <button @click="open">open</button> 9 </div> 10</template> 11 12<script> 13import { useDropzone } from "vue3-dropzone"; 14 15export default { 16 name: "UseDropzoneDemo", 17 setup() { 18 function onDrop(acceptFiles, rejectReasons) { 19 console.log(acceptFiles); 20 console.log(rejectReasons); 21 } 22 23 const { getRootProps, getInputProps, ...rest } = useDropzone({ onDrop }); 24 25 return { 26 getRootProps, 27 getInputProps, 28 ...rest, 29 }; 30 }, 31}; 32</script>
Save multiple files through axios requests and FormData. You will need a backend to loop through the received files and save them individually in the loop.
1<template> 2 <div> 3 <div v-bind="getRootProps()"> 4 <input v-bind="getInputProps()" /> 5 <p v-if="isDragActive">Drop the files here ...</p> 6 <p v-else>Drag 'n' drop some files here, or click to select files</p> 7 </div> 8 <button @click="open">open</button> 9 </div> 10</template> 11 12<script> 13import { useDropzone } from "vue3-dropzone"; 14import axios from "axios"; 15 16export default { 17 name: "UseDropzoneDemo", 18 setup() { 19 const url = "{your_url}"; // Your url on the server side 20 const saveFiles = (files) => { 21 const formData = new FormData(); // pass data as a form 22 for (var x = 0; x < files.length; x++) { 23 // append files as array to the form, feel free to change the array name 24 formData.append("images[]", files[x]); 25 } 26 27 // post the formData to your backend where storage is processed. In the backend, you will need to loop through the array and save each file through the loop. 28 29 axios 30 .post(url, formData, { 31 headers: { 32 "Content-Type": "multipart/form-data", 33 }, 34 }) 35 .then((response) => { 36 console.info(response.data); 37 }) 38 .catch((err) => { 39 console.error(err); 40 }); 41 }; 42 43 function onDrop(acceptFiles, rejectReasons) { 44 saveFiles(acceptFiles); // saveFiles as callback 45 console.log(rejectReasons); 46 } 47 48 const { getRootProps, getInputProps, ...rest } = useDropzone({ onDrop }); 49 50 return { 51 getRootProps, 52 getInputProps, 53 ...rest, 54 }; 55 }, 56}; 57</script>
1const result = useDropzone(options)
options
property | type | description |
---|---|---|
onDrop | Function | Cb for when the drop event occurs. Note that this callback is invoked after the getFilesFromEvent callback is done. |
accept | String / Array<*String> | Set accepted file types. See https://github.com/okonet/attr-accept for more information. |
disabled | Boolean | Enable/disable the dropzone |
maxSize | Number | Maximum file size (in bytes) |
minSize | Number | Minimum file size (in bytes) |
multiple | Number | Allow of multiple files |
maxFiles | Number | Maximum accepted number of files The default value is 0 which means there is no limitation to how many files are accepted |
getFilesFromEvent | Function | Use this to provide a custom file aggregator |
onDragEnter | Function | Cb for when the dragenter event occurs. |
onDragenter | Function | Cb for when the dragenter event occurs. |
onDragOver | Function | Cb for when the dragover event occurs |
onDragover | Function | Cb for when the dragover event occurs |
onDragLeave | Function | Cb for when the dragleave event occurs |
onDragleave | Function | Cb for when the dragleave event occurs |
onDropAccepted | Function | Cb for when the drop event occurs. Note that if no files are accepted, this callback is not invoked. |
onDropRejected | Function | Cb for when the drop event occurs. Note that if no files are rejected, this callback is not invoked. |
onFileDialogCancel | Function | Cb for when closing the file dialog with no selection |
preventDropOnDocument | Boolean | If false , allow dropped items to take over the current browser window |
noClick | Boolean | If true , disables click to open the native file selection dialog |
noKeyboard | Boolean | If true , disables SPACE/ENTER to open the native file selection dialog. Note that it also stops tracking the focus state. |
noDrag | Boolean | If true , disables drag 'n' drop |
noDragEventsBubbling | Boolean | If true , stops drag event propagation to parents |
result
property | type | description |
---|---|---|
isFocused | Ref<Boolean> | |
isFileDialogActive | Ref<Boolean> | |
isDragActive | Ref<Boolean> | |
isDragAccept | Ref<Boolean> | |
isDragReject | Ref<Boolean> | |
draggedFiles | Ref<Array> | dragged files |
acceptedFiles | Ref<Array> | accepted files |
fileRejections | Ref<Array> | files rejections |
getRootProps | Function | Function to generate element props which contains input |
getInputProps | Function | Function to generate input props |
rootRef | Ref<*HTMLElement> | ref a dom element |
inputRef | Ref<*HTMLElement> | ref a input element |
open | Function | Open file selection dialog |
cd examples
yarn install
yarn dev
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More