mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(item): sliding item should not close when clicking an option button
fixes #8481
This commit is contained in:
@ -73,7 +73,9 @@ export class ItemSlidingGesture extends PanGesture {
|
||||
}
|
||||
|
||||
notCaptured(ev: any) {
|
||||
this.closeOpened();
|
||||
if (!clickedOptionButton(ev)) {
|
||||
this.closeOpened();
|
||||
}
|
||||
}
|
||||
|
||||
closeOpened(): boolean {
|
||||
@ -99,9 +101,14 @@ export class ItemSlidingGesture extends PanGesture {
|
||||
}
|
||||
|
||||
function getContainer(ev: any): ItemSliding {
|
||||
let ele = ev.target.closest('ion-item-sliding', true);
|
||||
let ele = ev.target.closest('ion-item-sliding');
|
||||
if (ele) {
|
||||
return (<any>ele)['$ionComponent'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function clickedOptionButton(ev: any): boolean {
|
||||
let ele = ev.target.closest('ion-item-options>button');
|
||||
return !!ele;
|
||||
}
|
||||
|
@ -39,6 +39,10 @@ export class E2EPage {
|
||||
this.list.closeSlidingItems();
|
||||
}
|
||||
|
||||
noclose(item: ItemSliding) {
|
||||
console.log('no close', item);
|
||||
}
|
||||
|
||||
unread(item: ItemSliding) {
|
||||
if (item) {
|
||||
item.close();
|
||||
|
@ -31,8 +31,8 @@
|
||||
</a>
|
||||
|
||||
<ion-item-options side="left">
|
||||
<button ion-button icon-only (click)="unread(item100)">
|
||||
<ion-icon name="mail"></ion-icon>
|
||||
<button ion-button icon-only (click)="noclose(item100)">
|
||||
No close
|
||||
</button>
|
||||
</ion-item-options>
|
||||
<ion-item-options side="right">
|
||||
|
Reference in New Issue
Block a user