[英]Angular ui-sortable not working on mobile devices
我目前正在開發一個包含一些測試的AngularJS應用程序。 在其中一些我有一個列表,用戶必須通過拖放來正確訂購。
我正在使用angular-ui-sortable來實現這一點。 在 PC 和筆記本電腦上,它可以完美運行。 當用戶使用移動設備時,問題就會出現,然后停止工作。
我可以想象它與手機上的垂直滾動沖突,還是我完全錯了? 有沒有人也遇到過這個問題並提出了解決方案? 或者可能會指出我正確的方向,我會非常感激。
HTML (如果需要,我的 html)
<ul ui-sortable ng-model="sequence" class="list-group list-group-lg list-group-sp">
<li ng-repeat="choice in choices" class="list-group-item" draggable="true">
<h5>{{choice.name}}</h5>
</li>
</ul>
根據文檔和github repo上打開的問題,您可以添加jquery-ui來解決此問題。 您可以從項目 README 中查看這支筆以供參考。
這是筆上用於它的代碼:
HTML
<div class="floatleft">
<ul ui-sortable="sortableOptions" ng-model="list" class="list">
<li ng-repeat="item in list" class="item">
{{item.text}}
</li>
</ul>
</div>
控制器
$scope.sortableOptions = {
update: function(e, ui) {
var logEntry = tmpList.map(function(i){
return i.value;
}).join(', ');
$scope.sortingLog.push('Update: ' + logEntry);
},
stop: function(e, ui) {
// this callback has the changed model
var logEntry = tmpList.map(function(i){
return i.value;
}).join(', ');
$scope.sortingLog.push('Stop: ' + logEntry);
}
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.