你的意思是多个单独的拖放?就像用一根手指拖动一个元素,用另一根手指拖动第二个元素?
Dragula 和 Dragular 都不支持,但我正在开发可能的新库,但它现在仍在进行中:/
我不知道有任何其他图书馆支持它。
编辑(27.11.16):
我已经更新了你的笔http://codepen.io/luckylooke/pen/zodmEO
angular.module("testDnD", ["dragularModule"]).
controller("test", ['$scope', 'dragularService', function($scope, dragularService) {
$scope.selected = [];
$scope.filter = [];
$scope.testObj = [{...}];
$scope.modelClickData = function(test) {
console.log(test);
$scope.popdata = test;
};
$scope.modelSelect = function(test) {
test.selected = !test.selected;
if (test.selected)
$scope.selected.push(test);
else
$scope.selected.splice($scope.selected.indexOf(test), 1);
// console.log('selected', test);
};
var containerLeft = document.querySelector('#thumbnailTST');
var containerRight = document.querySelector('#filler');
dragularService.cleanEnviroment();
dragularService([containerLeft, containerRight], {
copy: true,
containersModel: [$scope.testObj, $scope.filter],
scope: $scope
});
$scope.$on('dragularcloned', function() {
var mirror = $('.gu-mirror');
if ($scope.selected.length > 1 && mirror.length) { // is multiple drag
mirror.addClass('multipledrag');
}
});
$scope.$on('dragulardrop', function(e, el, targetcontainer, sourcecontainer, conmodel, elindex, targetmodel, dropindex) {
if ($scope.selected.length > 1) { // is multiple drag
$scope.selected.forEach(function(item) {
if (item != $scope.testObj[elindex]) {
var clone = {};
clone = $.extend(true, clone, item);
delete clone.$$hashKey;
$scope.filter.splice(++dropindex, 0, clone);
}
});
}
console.log($scope.filter);
});
}])