@HostListener('mouseenter') onMouseEnter() {
this.highlight(this.hight||'red');
}
@HostListener('mouseleave') onMouseLeave() {
this.highlight(null);
}
private highlight(color: string) {
this.el.nativeElement.style.backgroundColor = color;
}
转载于:https://www.cnblogs.com/xiongwei2017/p/7076024.html