ionic具有ItemReorder的漂亮功能。示例代码如下
<ion-list reorder="true" (ionItemReorder)="reorderItems($event)">
<ion-item *ngFor="let item of listOfItems">
<ion-label>
{{item}}
</ion-label>
</ion-item>
</ion-list>
reorderItems(event) {
let element = this.listOfItems[event.from];
this.listOfItems.splice(event.from, 1);
this.listOfItems.splice(event.to, 0, element);
}
[一段时间后,重新排序(当您拖动并重新排序项目时)将无法在浏览器(http://localhost:4200)上使用。
解决方案: 关闭浏览器,然后在新的浏览器/隐身模式下再次打开,然后重新排序功能将起作用。