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