Delete Swipe gestures in ionic 3

前端 未结 1 564
孤独总比滥情好
孤独总比滥情好 2021-01-29 06:51

I want to create an ionic delete swipe gesture but it doesn\'t seem to work.

**This is my home page ( i called it myPage.html)**
    
      <         


        
相关标签:
1条回答
  • 2021-01-29 07:29

    As per the docs, you need to put the ion-item inside ion-item-sliding component.

    Thus, the structure of your markup should be:

    <ion-list>
        <ion-item-sliding *ngFor="let item of items">
            <ion-item>
                {{item.title}}
            </ion-item>
            <ion-item-options side="right">
                <button ion-button (click)="delete(item)">
                    <ion-icon name="trash"></ion-icon>Delete
                </button>
            </ion-item-options>
        </ion-item-sliding>
    </ion-list>
    

    Refer here for the sample: https://stackblitz.com/edit/ionic-eofb82

    0 讨论(0)
提交回复
热议问题