mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 08:09:32 +08:00
@ -191,7 +191,7 @@ export class Toast implements ComponentInterface, OverlayInterface {
|
|||||||
}
|
}
|
||||||
const shouldDismiss = await this.callButtonHandler(button);
|
const shouldDismiss = await this.callButtonHandler(button);
|
||||||
if (shouldDismiss) {
|
if (shouldDismiss) {
|
||||||
return this.dismiss(undefined, button.role);
|
return this.dismiss(undefined, role);
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@ -213,6 +213,14 @@ export class Toast implements ComponentInterface, OverlayInterface {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private dispatchCancelHandler = (ev: CustomEvent) => {
|
||||||
|
const role = ev.detail.role;
|
||||||
|
if (isCancel(role)) {
|
||||||
|
const cancelButton = this.getButtons().find(b => b.role === 'cancel');
|
||||||
|
this.callButtonHandler(cancelButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderButtons(buttons: ToastButton[], side: 'start' | 'end') {
|
renderButtons(buttons: ToastButton[], side: 'start' | 'end') {
|
||||||
if (buttons.length === 0) {
|
if (buttons.length === 0) {
|
||||||
return;
|
return;
|
||||||
@ -265,6 +273,7 @@ export class Toast implements ComponentInterface, OverlayInterface {
|
|||||||
...getClassMap(this.cssClass),
|
...getClassMap(this.cssClass),
|
||||||
'toast-translucent': this.translucent
|
'toast-translucent': this.translucent
|
||||||
}}
|
}}
|
||||||
|
onIonToastWillDismiss={this.dispatchCancelHandler}
|
||||||
>
|
>
|
||||||
<div class={wrapperClass}>
|
<div class={wrapperClass}>
|
||||||
<div class="toast-container">
|
<div class="toast-container">
|
||||||
|
|||||||
Reference in New Issue
Block a user