Registry / web-framework / vue2-dropzone

vue2-dropzone

JSON →
library3.6.0jsnpmunverified

Vue2-dropzone is a Vue 2 wrapper component for the popular Dropzone.js library, enabling easy integration of drag-and-drop file upload functionalities into Vue applications. The current stable version is 3.6.0. While the project is functional and receives periodic maintenance updates for bug fixes, dependency upgrades (such as Dropzone.js itself), and minor feature enhancements like support for new image formats, it is actively seeking co-maintainers, indicating a shift towards community-driven maintenance. Its primary differentiator is providing a pre-packaged Vue 2 component for Dropzone.js, abstracting away direct DOM manipulation. A separate, Nuxt SSR-compatible version is also available from a different maintainer. Releases are typically driven by bug reports, security patches, and updates to the underlying Dropzone.js library.

npm install vue2-dropzone
INSTALL
IMPORT
SIG · VUE2-DROPZONE
V
vue2-dropzone
web-frameworkjavascriptv3.6.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VueDropzone
import VueDropzone from 'vue2-dropzone';
const VueDropzone = require('vue2-dropzone');
This component is typically imported as a default export and registered globally or locally within a Vue component. Using `require()` is a CommonJS pattern less common in modern Vue CLI setups.
CSS
import 'vue2-dropzone/dist/vue2Dropzone.min.css';
import 'dropzone/dist/dropzone.css';
The component ships its own compiled CSS. It's crucial to import this specific path to ensure proper styling; importing the base Dropzone.js CSS directly may lead to styling conflicts or missing styles.
Component Usage
<vue-dropzone ref="myVueDropzone" id="dropzone" :options="dropzoneOptions" @vdropzone-success="dropzoneSuccess"></vue-dropzone>
<dropzone ...></dropzone>
The component tag is named `vue-dropzone` after registration, not `dropzone`. Ensure prop binding (e.g., `:options`) and event handling (`@vdropzone-event`) are correctly implemented.

This example demonstrates how to integrate `vue2-dropzone` into a Vue 2 component, configuring various upload options such as URL, file size, accepted types, and custom headers, while also handling success and error events during file uploads. It includes the necessary CSS import and shows how to use the component in a template.

import { defineComponent } from 'vue'; import VueDropzone from 'vue2-dropzone'; import 'vue2-dropzone/dist/vue2Dropzone.min.css'; export default defineComponent({ name: 'FileUploadComponent', components: { VueDropzone }, data() { return { dropzoneOptions: { url: 'https://httpbin.org/post', // Replace with your actual upload endpoint thumbnailWidth: 150, // px maxFilesize: 2, // MB acceptedFiles: '.jpeg,.jpg,.png,.gif,.webp', // Supported file types addRemoveLinks: true, dictDefaultMessage: 'Drop files here or click to upload.', headers: { 'X-CSRF-TOKEN': process.env.VUE_APP_CSRF_TOKEN ?? '', // Example for CSRF token 'Custom-Header': 'MyValue' }, // Optionally disable auto-processing and manually trigger uploads // autoProcessQueue: false, } }; }, methods: { dropzoneSuccess(file, response) { console.log('File uploaded successfully!', file, response); // Access component instance to interact with Dropzone.js methods // (this.$refs.myVueDropzone as any).removeFile(file); }, dropzoneError(file, message, xhr) { console.error('Error uploading file:', file, message, xhr); }, dropzoneRemovedFile(file, error, xhr) { console.log('File removed from queue:', file); }, // Example of a manual upload trigger // processQueue() { // (this.$refs.myVueDropzone as any).processQueue(); // } } });
Debug
Known issues
breakingVersion 3.0.1 introduced a complete revamp of the component, which implies significant internal and external API changes. Users migrating from 2.x versions should expect breaking changes in how the component is configured and used.
fix
Thoroughly review the changelog for v3.0.0 and subsequent versions. Re-evaluate your component's API usage, prop configurations, and event listeners based on the updated documentation.
affects: >=3.0.1
gotchaThe project is actively seeking co-maintainers. While still functional, this explicit request suggests that future development, bug fixes, and feature additions might slow down without increased community involvement.
fix
Be aware of the project's maintenance status. If critical to your application, consider contributing to its upkeep or evaluating alternatives for long-term support. Monitor the GitHub issues for updates.
affects: *
gotchaProp naming conventions were updated in v3.6.0. This might lead to issues if existing prop names in your template do not match the new conventions, potentially causing props to not be recognized or function correctly.
fix
Review the updated documentation and codebase for any changes in prop naming. Ensure your template attributes align with the component's expected prop names, typically moving towards kebab-case for HTML attributes.
affects: >=3.6.0
gotchaPrior to v3.3.0, manually adding a non-image file could break the preview functionality. While fixed, this highlights potential fragility in handling various file types or edge cases in older versions.
fix
Ensure you are using version 3.3.0 or newer to avoid this specific preview issue. Always include client-side validation for accepted file types and ensure robust error handling for unexpected file inputs.
affects: <3.3.0
Errors
Common errors & fixes
Error in render: 'Error: No URL provided.'
The `url` option in `dropzoneOptions` is either missing or an empty string, which is required by Dropzone.js for uploads.
fix
Ensure `dropzoneOptions.url` is set to a valid endpoint URL for your file uploads. For signed URL scenarios (e.g., AWS S3), this URL will be provided dynamically, but a base URL might still be required.
Failed to load resource: the server responded with a status of 404 (Not Found) for `vue2Dropzone.min.css`
The CSS import path is incorrect, or the `vue2-dropzone` package's `dist` directory is not correctly resolved by your build tool.
fix
Verify the exact import statement: `import 'vue2-dropzone/dist/vue2Dropzone.min.css';`. Check your `node_modules/vue2-dropzone/dist` directory to confirm the file exists at that path.
Property 'processQueue' does not exist on type 'Vue | Element | Vue[] | Element[]'
When using TypeScript, the `this.$refs` object does not automatically infer the specific type of the `vue2-dropzone` component, requiring a type assertion.
fix
Cast the ref to `any` or the specific component instance type if available: `(this.$refs.myVueDropzone as any).processQueue();` or `(this.$refs.myVueDropzone as typeof VueDropzone).processQueue();`
Files are not being uploaded, or server receives incorrect headers/payload for AWS S3.
Misconfiguration of AWS S3-specific options (`awsS3` object), or issues with sending `contentType`, `filePath`, or other parameters to the S3 signing URL endpoint.
fix
Refer to the documentation for AWS S3 upload functionality (versions 3.0.3, 3.0.4, 3.1.0). Ensure all required parameters and headers are correctly configured and passed to your URL signing service.
Upgrade
Version history
3.6.0latest on npm
Audit
Dependencies
dropzonerequiredProvides the core drag-and-drop file upload functionality.
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources