Search code examples
vue.jsvuedraggable

Vuedraggable | Passing a parameter to :move


Is there a way to pass a parameter to the :move event like:

<draggable :move="onMove(param)"> </draggable>

and then be able to use that along with event like:

methods: {
  onMove(event, param) {
    // do stuff
  }
}

Solution

  • You can do as such:

    <draggable :move="(event) => onMove(event, 'someOtherVariableInThisExampleJustAString')">
    

    And, naturally, use it like:

    methods: {
      onMove(event, param) {
        // do stuff
      }
    }
    

    See demo fiddle: https://jsfiddle.net/acdcjunior/5scaju6w/