Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has this plugin any incompatibility with vue 2.0? #10

Open
arquadrado opened this issue Sep 12, 2016 · 16 comments
Open

has this plugin any incompatibility with vue 2.0? #10

arquadrado opened this issue Sep 12, 2016 · 16 comments

Comments

@arquadrado
Copy link

I'm trying to use this plugin with vue 2.0 and I'm always getting the following error 'Uncaught Sortable: el must be HTMLElement, and not [object Undefined]'

Any help would be most appreciated. Thanks

@sagalbot
Copy link
Owner

I haven't done any testing with 2.0, but I know that directives were changed significantly. Sounds like the last release candidate is out, so I'll get this updated in the near future.

@jasonlfunk
Copy link

I'm using your library in a project that I'm upgrading to 2.0. I was able to replace the directive with this:

    Vue.directive('sortable', {
      inserted: function (el, binding) {
        var sortable = new Sortable(el, binding.value || {});
      }
    });

You'll notice that I removed some of the code around saving references to the sortable. As directives no longer have an instance associated with them, I don't know that it's possible to restore this functionality. However, I wasn't using it so it wasn't a problem.

@kminek
Copy link

kminek commented Oct 4, 2016

hi there :) finally i managed to get sortable working with vue 2: http://codepen.io/kminek/pen/pEdmoo - maybe it will help to upgrade this plugin :)

@alan-andrade
Copy link

@kminek your fix worked for me. Thank you.

@websanova
Copy link

Can this fix be pushed up to npm?

@FrankFang
Copy link

FrankFang commented Jan 15, 2017

Hey guys, the code is so simple, just put this shit into your project and get it work for Vue 2:

import Vue from 'vue'
import Sortable from 'sortablejs'

Vue.directive('sortable', {
  inserted: function (el, binding) {
    new Sortable(el, binding.value || {})
  }
})

Why bother to introduce another lib? Right?

And remember to add keys for your items: vuejs/vue#4085 (comment)

Full example by @Ivannnnn

https://jsfiddle.net/1khq32ed/10/

@Ivannnnn
Copy link

Ivannnnn commented Feb 1, 2017

Full example:
https://jsfiddle.net/1khq32ed/10/

@ItsRD
Copy link

ItsRD commented Feb 22, 2017

Any of you have the following problem? __WEBPACK_IMPORTED_MODULE_1_vue_sortable___default.a is not a constructor

@fernandomm
Copy link

@ItsRD I'm also experiencing this problem. Were you able to find a solution?

@ItsRD
Copy link

ItsRD commented Mar 8, 2017

@fernandomm Nope, I'm still waiting for a solution..

@fernandomm
Copy link

@ItsRD I found the solution. I was importing vue-sortable but, as per #10 (comment), only sortablejs should be imported.

@ItsRD
Copy link

ItsRD commented Mar 8, 2017

@fernandomm aah thanks! I'll look at that! :)

@ItsRD
Copy link

ItsRD commented Mar 22, 2017

@fernandomm just took a look at it, works perfectly! Thanks! 👍

@grzegorztomasiak
Copy link

Can someone explain me why solution given by FrankFang does not work for me and console.log(Sortable) returns undefined and when I change import to

import * as Sortable from 'sortablejs/Sortable.js'

then it works?

@abdessamadely
Copy link

Yeap! it's working now

@432player
Copy link

Works like Magic!
Thank you for the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests