mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 08:09:32 +08:00
feat(item): listen for core $ionStyle events
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, QueryList, Renderer, Optional, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, HostListener, QueryList, Renderer, Optional, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
import { Form } from '../../util/form';
|
import { Form } from '../../util/form';
|
||||||
@ -334,6 +334,15 @@ export class Item extends Ion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('$ionStyle', ['$event'])
|
||||||
|
itemStyle(ev: any) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
Object.keys(ev.detail).forEach(cssClassName => {
|
||||||
|
this._elementRef.nativeElement.classList[ev.detail[cssClassName] ? 'add' : 'remove']('item-' + cssClassName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user