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 some problem use this in vue 2.0 #15

Open
scq000 opened this issue Oct 14, 2016 · 5 comments
Open

Has some problem use this in vue 2.0 #15

scq000 opened this issue Oct 14, 2016 · 5 comments

Comments

@scq000
Copy link

scq000 commented Oct 14, 2016

When use v-sortable directive , the code gives following exception:

Uncaught Sortable: `el` must be HTMLElement, and not [object Undefined]

And nothing gets rendered.
Libraries versions used:

"sortablejs": "^1.4.2",
"vue": "^2.0.1",
"vue-sortable": "^0.1.3"
@MunGell
Copy link

MunGell commented Oct 17, 2016

This library is not compatible with Vue.js 2.0 at the moment due to significant API changes in the new version.

Update: there is a PR for supporting v2: #13

@revati
Copy link

revati commented Nov 1, 2016

I added issue in vuejs repository vuejs/vue#4085
I got it working (sort of) It has odd bug (dom does not sync with state)

@FrankFang
Copy link

#10 (comment)

@chamberlainpi
Copy link

👍

@yunbiji
Copy link

yunbiji commented Mar 7, 2018

谢谢 @FrankFang 提供的方案 #10 (comment)

// your Vue
import Vue from 'vue'
import Sortable from 'sortablejs'

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

之前自己的

// your Vue
import Sortable from 'sortablejs'
Vue.use(Sortable);
// vue-sortable/vue-sortable.js
Vue.directive('sortable', function (el, options) {
      options = options || {}
      var sortable = new Sortable(el || this.el, options)

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

6 participants