Angular ui- sorable不能在移动设备上工作

Angular ui-sortable not working on mobile devices

本文关键字:工作 移动 ui- sorable 不能 Angular      更新时间:2023-09-26

我目前正在开发一个AngularJS应用程序,其中包含一些测试。在其中一些程序中,我有一个列表,用户必须通过拖放来正确排序。

我使用angular-ui-sortable来完成这个。在个人电脑和笔记本电脑上,它工作完美。当用户使用移动设备时,问题就出现了,然后它就停止工作了。

我可以想象它与手机上的垂直滚动冲突,还是我完全错了?有没有人遇到过这个问题,并提出了解决方案?如果你能给我指出正确的方向,我会很感激的。

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中查看这支笔以供参考。

下面是它在笔上的代码:

 <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);
    }
  };