Vue-dropzone: Register the Component

Created on 16 Jan 2017  路  5Comments  路  Source: rowanwins/vue-dropzone

Hi,

I understand how to npm install and how to import, but i don't know how to register the component. What is the path?

Thanks!

Most helpful comment

Ah, i figured it out.

First you import the Dropzone
import Dropzone from 'vue2-dropzone

And after that you can set it as a global component like so...

Vue.Component('dropzone', Dropzone)

All 5 comments

Hi @ServerJunge

The documentation shows you how to register the component....
````

````
Let me know what bit in particular you are stuck on.

Thanks for your answer. I have an app.js file where I import my plugins.

import Dropzone from 'vue2-dropzone'

Here is a part of my app.js with examples for other plugins.

// Import Plugins

import VueForm from 'vform'
import VueBreadcrumbs from 'vue2-breadcrumbs'
import Dropzone from 'vue2-dropzone'

// Install Plugins
Vue.use(VueForm, {components: true})
Vue.use(VueBreadcrumbs)

// Set Components
Vue.component('breadcrumb', require('./components/helper/Breadcrumb.vue'));
Vue.component('profile-picture', require('./components/settings/Profile-Picture.vue'));

How to I set the dropzone component here?

mmm those look like components that are being registered globally,

perhaps try something lke
import Dropzone from 'vue2-dropzone' Vue.use(Dropzone)
after you've done that you should be able to bring it in normally like
<dropzone id="myVueDropzone" url="https://httpbin.org/post"></dropzone>
Cant say i've ever tried doing it this way

Ah, i figured it out.

First you import the Dropzone
import Dropzone from 'vue2-dropzone

And after that you can set it as a global component like so...

Vue.Component('dropzone', Dropzone)

Solution: Vue.component('dropzone', Dropzone)

Was this page helpful?
0 / 5 - 0 ratings