Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
最初渲染网格时,它遵循其后面的列表(模型)的顺序。在按列排序后,如何恢复到相同的自然顺序?
在 ng-repeater 中,您可以将自定义数据属性设置为{{$index}}
{{$index}}
<li class="sortable" ng-repeat="item in items" data-index="{{$index}}">
然后,当操作 DOM 以生成列排序时,呈现时的索引将保留在data-index
data-index