mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
floating labels
This commit is contained in:
@ -57,6 +57,14 @@ export class TextInputElement {
|
||||
get hasFocus() {
|
||||
return dom.hasFocus(this.elementRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the input has a value.
|
||||
* @returns {boolean} true if the input has a value, otherwise false.
|
||||
*/
|
||||
get hasValue() {
|
||||
return (this.elementRef.nativeElement.value !== '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,6 +83,7 @@ export class TextInputElement {
|
||||
'(^touchend)': 'pointerEnd($event)',
|
||||
'(^mouseup)': 'pointerEnd($event)',
|
||||
'[class.has-focus]': 'inputHasFocus',
|
||||
'[class.has-value]': 'inputHasValue',
|
||||
'[tabIndex]': 'activeTabIndex',
|
||||
'class': 'item'
|
||||
}
|
||||
@ -404,6 +413,10 @@ export class TextInput extends Ion {
|
||||
return !!this.input && this.input.hasFocus;
|
||||
}
|
||||
|
||||
get inputHasValue() {
|
||||
return !!this.input && this.input.hasValue;
|
||||
}
|
||||
|
||||
get activeTabIndex() {
|
||||
this.input.tabIndex = (this.inputHasFocus ? 1000 : -1);
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user