Search code examples
vue.draggable

Is it possible to set default options for vue.draggable?


I was wondering if it is possible to set default options for Vue.draggable? Currently I find I need to keep supply the options for each draggable when some (like the handle and scroll sensitivity) would be better set globally.

%draggable{ 'v-model': 'values', '@change': 'move', ':options': '{handle: ".handle", scrollSensitivity: 80}', 'element': 'tbody' }

Excuse the HAML.


Solution

  • It is not possible, You can use a store to keep the default parameters and reuse them in diferent components. Note that starting with version 2.19 the syntax is:

    v-bind="{handle: '.handle', scrollSensitivity: 80}"
    

    Or

    handle=".handle" :scrollSensitivity="80"