zhanziyang / vue-croppa

A simple straightforward customizable mobile-friendly image cropper for Vue 2.0.
https://zhanziyang.github.io/vue-croppa/
ISC License
967 stars 128 forks source link

Async loading #6

Closed fortael closed 7 years ago

fortael commented 7 years ago

Really great component, thanks. But here is not possible to load component asynchronously.

Vue.component('croppa ', resolve => {
    require.ensure([], function() {
        require('vue-croppa/dist/vue-croppa.css');
        resolve(require('vue-croppa'));
    });
}); 

I need a construction like that. But Vue.component already in it. Can you provide some methods to get exactly component? Like require('vue-croppa').component. Because here is nothing extraordinary in install script. Looking forward. Thanks

zhanziyang commented 7 years ago

I will look into that. Thanks!

zhanziyang commented 7 years ago

hey man, try this out:

Vue.component('croppa ', resolve => {
    require.ensure([], function() {
        resolve(require('vue-croppa/src/cropper.vue'));
    });
}); 

Edit: new version v0.1.1 supports require('vue-croppa').component : )