Vue.draggable: @click or v-on:click doesn't work in draggable element

Created on 4 May 2017  路  5Comments  路  Source: SortableJS/Vue.Draggable

I'm using and the drag/drop functionality is working great but I'm trying to capture a click event inside the draggable container and the click event is not being fired whether I use @click or v-on:click inside of the element.

<draggable class="audience-group include" :class="{'selected':current_index == index}" @end="dragStop" v-for="(inc,index) in includes" v-model="includes[index]" :options="{group:'audiences'}" @click="focusBuilderGroup('include',index)">

In this case, focusBuilderGroup will set the current_index to the container that was just clicked (adds the class of selected). This worked outside of the draggable element.

question

Most helpful comment

Hello @zhegwood , You should use: v-on:click.native="focusBuilderGroup('include',index)"
Ref: https://vuejs.org/v2/guide/components.html#Using-v-on-with-Custom-Events

All 5 comments

Hello @zhegwood , You should use: v-on:click.native="focusBuilderGroup('include',index)"
Ref: https://vuejs.org/v2/guide/components.html#Using-v-on-with-Custom-Events

Excellent, thanks.

I'm facing the same problem using Vue.Draggable v1. But I can't use the event modifier .navtive which was introduced in Vue 2. Is there a way to solve this?

@semmel87 , I have no idea. Maybe you should post this question on vue.js forum as it is related to vue implementation and not this plugin.

Thank you so much @David-Desmaisons . This really saved my day.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leadaxe picture Leadaxe  路  3Comments

ghost picture ghost  路  3Comments

Sualty picture Sualty  路  3Comments

clemsontiger picture clemsontiger  路  3Comments

Nrqz picture Nrqz  路  3Comments