mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
Merge remote-tracking branch 'origin/main' into sp/sync-feature-7-6-with-main
This commit is contained in:
@ -3,7 +3,13 @@ import { Build, Component, Element, Event, Host, Method, Prop, State, Watch, for
|
||||
import type { LegacyFormController, NotchController } from '@utils/forms';
|
||||
import { createLegacyFormController, createNotchController } from '@utils/forms';
|
||||
import type { Attributes } from '@utils/helpers';
|
||||
import { inheritAriaAttributes, debounceEvent, findItemLabel, inheritAttributes } from '@utils/helpers';
|
||||
import {
|
||||
inheritAriaAttributes,
|
||||
debounceEvent,
|
||||
findItemLabel,
|
||||
inheritAttributes,
|
||||
componentOnReady,
|
||||
} from '@utils/helpers';
|
||||
import { printIonWarning } from '@utils/logging';
|
||||
import { createSlotMutationController } from '@utils/slot-mutation-controller';
|
||||
import type { SlotMutationController } from '@utils/slot-mutation-controller';
|
||||
@ -430,7 +436,14 @@ export class Input implements ComponentInterface {
|
||||
* Returns the native `<input>` element used under the hood.
|
||||
*/
|
||||
@Method()
|
||||
getInputElement(): Promise<HTMLInputElement> {
|
||||
async getInputElement(): Promise<HTMLInputElement> {
|
||||
/**
|
||||
* If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
|
||||
* nativeInput won't be defined yet with the custom elements build, so wait for it to load in.
|
||||
*/
|
||||
if (!this.nativeInput) {
|
||||
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
||||
}
|
||||
return Promise.resolve(this.nativeInput!);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user