question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Has some problem use this in vue 2.0

See original GitHub issue

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"

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
MunGellcommented, 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: https://github.com/sagalbot/vue-sortable/pull/13

2reactions
yunbijicommented, Mar 8, 2018

谢谢 @FrankFang 提供的方案 https://github.com/sagalbot/vue-sortable/issues/10#issuecomment-272709457

// 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)
Read more comments on GitHub >

github_iconTop Results From Across the Web

has this plugin any incompatibility with vue 2.0? #10 - GitHub
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, ...
Read more >
vue.js - could not render all <div>s within a template
I am composing a modal component as I learn VueJS. The modal component basically consists of two major elements: the actual box containing...
Read more >
Frequently Asked Questions - Vue.js
A hello world Vue app that only uses the absolutely minimal APIs has a baseline size of only around 16kb, with minification and...
Read more >
Vue router not work in action.js and other file [ Vue 2.0 ]
I've migrated from vue 1.0 to 2.0 and have some problem that I can't use router in actions.js in 1.0 it's work properly...
Read more >
[SOLVED] This.$refs.key returns undefined when it really is
Hello. I have a problem exactly the same as defined here although this one is archived. I am using Vue 2.0 with Webpack....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found