mazipan / vue-select-image

✅ Vue 2.x component for selecting image from list

Home Page:https://mazipan.github.io/vue-select-image/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot listen event onSelectImage

eossa opened this issue · comments

I am using the component like this
<vue-select-image :data-images="templates" @onSelectImage="onSelectImage"></vue-select-image>

This is my component data

data: function() {
    return {
        templates: [
            {id: 1, src: this.asset('images/pdf/preview_1.png'), alt: ''},
            {id: 2, src: this.asset('images/pdf/preview_1.png'), alt: ''}
        ],
        template_selected: {},
    };
}

With this method handler

methods: {
    onSelectImage: function(template) {
        console.log('onSelectImage', template);
        this.template_selected = template;
    },
}

But when the event onSelectImage is fired the onSelectImage is not executed.

I am using this dependencies:
vue@2.5.11
vue-loader@11.3.4
vue-select-image@1.0.3

Also Vue show a tip in the developer tools
[Vue tip]: Event "onselectimage" is emitted in component but the handler is registered for "onSelectImage". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "on-select-image" instead of "onSelectImage".

Can you change the event name by on-select-image?

Will do, thanks