|
@@ -1,14 +1,36 @@
|
|
|
+import { IonList, IonItem, IonReorder } from '@ionic/angular/standalone';
|
|
|
import { Component } from '@angular/core';
|
|
|
-import { IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/angular/standalone';
|
|
|
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonLabel } from '@ionic/angular/standalone';
|
|
|
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
|
|
|
+import { IonReorderGroup } from '@ionic/angular/standalone';
|
|
|
+import { ItemReorderEventDetail } from '@ionic/angular';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab3',
|
|
|
templateUrl: 'tab3.page.html',
|
|
|
styleUrls: ['tab3.page.scss'],
|
|
|
standalone: true,
|
|
|
- imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent],
|
|
|
+ imports: [IonReorder ,IonList,IonReorderGroup,IonItem,IonLabel ,IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent],
|
|
|
})
|
|
|
export class Tab3Page {
|
|
|
constructor() {}
|
|
|
+ items = [1, 2, 3, 4, 5,6];
|
|
|
+
|
|
|
+ handleReorder(ev: CustomEvent<ItemReorderEventDetail>) {
|
|
|
+ // Before complete is called with the items they will remain in the
|
|
|
+ // order before the drag
|
|
|
+ console.log('Before complete', this.items);
|
|
|
+
|
|
|
+ // Finish the reorder and position the item in the DOM based on
|
|
|
+ // where the gesture ended. Update the items variable to the
|
|
|
+ // new order of items
|
|
|
+ this.items = ev.detail.complete(this.items);
|
|
|
+
|
|
|
+ // After complete is called the items will be in the new order
|
|
|
+ console.log('After complete', this.items);
|
|
|
+ }
|
|
|
+
|
|
|
+ trackItems(index: number, itemNumber: number) {
|
|
|
+ return itemNumber;
|
|
|
+ }
|
|
|
}
|