你的意思是多个独立的拖拽&滴?就像用一个手指拖动一个元素,用另一个手指拖动第二个元素一样?
那不是由dragula也不dragular支持,但我工作的新图书馆,这将是可能的,但还是现在正在进行中:/
我不知道任何其他库支持它。
EDIT(16年11月27日):
我已经更新了你的笔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);
});
}])
感谢@Luckylooke的回复。我急切地等着你回答这个问题。通过多次拖放我意味着我将能够选择多个元素,然后将其全部拖放到目标容器中。 – pBanyal
@pBanyal可以通过dragula或dragula完成,创建小提琴/ codepen/...与您的sceanrio,我可以帮助你解决这个问题;) – Luckylooke
道歉@Luckylooke回答太迟。对我来说有一些违规的最后期限。这是我的笔http://codepen.io/pBanyal/pen/ObjQPg,请让我知道是否需要其他任何东西。 – pBanyal