Skip to content

Commit

Permalink
fix(module: inputitem): fixed style flash (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
sWhite01111 authored and fisherspy committed Apr 10, 2019
1 parent b4cae44 commit 97bf63e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/input-item/input-item.component.ts
Expand Up @@ -5,12 +5,13 @@ import {
Output,
EventEmitter,
ViewChild,
OnInit,
OnChanges,
HostBinding,
Renderer2,
ElementRef,
forwardRef,
TemplateRef
TemplateRef,
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

Expand All @@ -25,7 +26,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
}
]
})
export class InputItem implements AfterViewInit, OnChanges, ControlValueAccessor {
export class InputItem implements OnInit, AfterViewInit, OnChanges, ControlValueAccessor {
prefixCls: string = 'am-input';
wrapCls: object;
labelCls: object;
Expand Down Expand Up @@ -379,11 +380,15 @@ export class InputItem implements AfterViewInit, OnChanges, ControlValueAccessor
}
}

ngOnInit() {
this.setCls();
this.render.addClass(this._el, this._prefixListCls + '-item');
this.render.addClass(this._el, this._prefixListCls + '-item-middle');
}

ngAfterViewInit() {
setTimeout(() => {
this.setCls();
this.render.addClass(this._el, this._prefixListCls + '-item');
this.render.addClass(this._el, this._prefixListCls + '-item-middle');
this.setCls();
}, 0);
}
}

0 comments on commit 97bf63e

Please sign in to comment.