feat(inputs): add focus() method

fixes #15266
fixes #15268
This commit is contained in:
Manu Mtz.-Almeida
2018-08-23 00:51:46 +02:00
parent d1ed57e68e
commit c66a34ab59
7 changed files with 54 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { Component, Element, Event, EventEmitter, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch } from '@stencil/core';
import { Color, Mode, StyleEvent, TextFieldTypes, TextInputChangeEvent } from '../../interface';
import { debounceEvent, deferEvent, renderHiddenInput } from '../../utils/helpers';
@@ -246,6 +246,13 @@ export class Input implements InputComponent {
this.ionInputDidUnload.emit();
}
@Method()
focus() {
if (this.nativeInput) {
this.nativeInput.focus();
}
}
private emitStyle() {
this.ionStyle.emit({
'interactive': true,

View File

@@ -55,6 +55,13 @@ It is meant for text `type` inputs only, such as `"text"`, `"password"`, `"email
| `ionStyle` | Emitted when the styles change. |
## Methods
| Method | Description |
| ------- | ----------- |
| `focus` | |
----------------------------------------------
*Built with [StencilJS](https://stenciljs.com/)*