Open scq000 opened 8 years ago
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
I added issue in vuejs repository https://github.com/vuejs/vue/issues/4085 I got it working (sort of) It has odd bug (dom does not sync with state)
:+1:
谢谢 @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)
When use
v-sortable
directive , the code gives following exception:And nothing gets rendered. Libraries versions used: