Make Vue.Dragable.For compatible with vuejs 2.0
I'm getting the following error: TypeError: dragableForDirective is undefined.
The relevant line in the traceback seems to be this one:
- buildVueDragFor/vueDragFor.install() build.js line 1340 > eval:53
This happens just after Vue.use(VueDragableFor).
Is there any information you'd like me to add?
I'm using vuejs 2.0. Is this the reason?
Hello @ninmesara, you are correct Vue.Dragable.For is currently only working with Vue.js 1. As directives have changed a lot in Vue.js 2.0, Vue.Dragable.For needs an important re-write. I am waiting for Vue 2.0 to stabilize before starting with work. I will rename this issue as a lembrete to make Vue.Dragable.For Vue 2.0 compatible.
Vue 2.0 is pretty close, I can't imagine what would change at this point that would cause issues with rewriting it now.
from https://github.com/vuejs/vue/issues/2873:
Directive interface change
In general, in 2.0 directives have a greatly reduced scope of responsibility: they are now only used for applying low-level direct DOM manipulations. In most cases, you should prefer using Components as the main code-reuse abstraction.
Directives no longer have instances - this means there's no more this inside directive hooks and bind, update and unbind now receives everything as arguments.
Note the binding object is immutable, setting binding.value will have no effect, and properties added to it will not be persisted. You can persist directive state on el if you absolutely need to:
Directive have changed a lot indeed.
Sorry, I'm not sure you understood my comment.
My point is Vue 2.0 is at a stable enough point that you can begin work on the next version of Vue.Dragable.For. I'm well aware of the directive changes :)
I got you now! You are correct it seems to be a good time to begin to work on this migration.
yes, vue 2.0 has been just officially released 4 days ago. :)
@beeplin , true: I am already working on migration to 2.0, Next version will probably be a component as directive have drastically changed in Vue.js 2.0.
Migration done: new component named draggable created