Open LuniChang opened 2 years ago
sortable.create(table, { handle: this.handle, animation: this.animate, onStart: () => { this.$emit("drag"); }, setData: function(dataTransfer) { // to avoid Firefox bug // Detail see : https://github.com/RubaXa/Sortable/issues/1012 dataTransfer.setData('Text', '') }, onEnd: ({ newIndex, oldIndex }) => { this.keepWrapperHeight(true); this.tableKey = Math.random(); const arr = this.$children[0].data; const targetRow = arr.splice(oldIndex, 1)[0]; arr.splice(newIndex, 0, targetRow); this.$emit("drop", { targetObject: targetRow, list: arr }); } });
以上是修复版本
sortable.create(table, { handle: this.handle, animation: this.animate, onStart: () => { this.$emit("drag"); }, setData: function(dataTransfer) { // to avoid Firefox bug // Detail see : https://github.com/RubaXa/Sortable/issues/1012 dataTransfer.setData('Text', '') }, onEnd: ({ newIndex, oldIndex }) => { this.keepWrapperHeight(true); this.tableKey = Math.random(); const arr = this.$children[0].data; const targetRow = arr.splice(oldIndex, 1)[0]; arr.splice(newIndex, 0, targetRow); this.$emit("drop", { targetObject: targetRow, list: arr }); } });