jofftiquez / vue-croppie

Vue wrapper for croppie
https://jofftiquez.github.io/vue-croppie/
MIT License
260 stars 42 forks source link

Register vue-croppie locally #81

Closed dakshshah96 closed 3 years ago

dakshshah96 commented 3 years ago

Can I register the VueCroppie component locally instead of in my main.js file?

When I try to do the following:

<template>
  <!-- just an example -->
  <vue-croppie ref="croppieRef"></vue-croppie>
</template>

<script>
import VueCroppie from 'vue-croppie'
import 'croppie/croppie.css'

export default {
  name: 'MyComponent',
  components: { VueCroppie },
}
</script>

I always get this error:

[Vue warn]: Unknown custom element: <vue-croppie> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Putting VueCroppie in main.js and doing Vue.use(VueCroppie) works as expected but I'd rather lazy load this library only on the page where I need it.

syther101 commented 3 years ago

I've just been using this package and you can fix importing the correct module.

<template>
  <!-- just an example -->
  <vue-croppie-component ref="croppieRef"></vue-croppie>
</template>

<script>
import {VueCroppieComponent} from 'vue-croppie'
import 'croppie/croppie.css'

export default {
  name: 'MyComponent',
  components: { VueCroppieComponent },
}
</script>

Hope this helps :)

dakshshah96 commented 3 years ago

@syther101 I feel dumb now. LOL. Thanks!