mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(datetime): cancel resets internal state of datetime
This commit is contained in:
@@ -550,15 +550,17 @@ export class Datetime implements ComponentInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits the ionCancel event and
|
||||
* optionally closes the popover
|
||||
* or modal that the datetime was
|
||||
* presented in.
|
||||
* The cancel method performs the following actions:
|
||||
* 1. Emits the ionCancel event
|
||||
* 2. Resets the internal state of the datetime
|
||||
* 3. Closes the parent popover or modal if "closeOverlay" is true.
|
||||
*/
|
||||
@Method()
|
||||
async cancel(closeOverlay = false) {
|
||||
this.ionCancel.emit();
|
||||
|
||||
this.reset();
|
||||
|
||||
if (closeOverlay) {
|
||||
this.closeParentOverlay();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user