【发布时间】:2020-08-07 12:58:24
【问题描述】:
我的代码如下,但它不起作用,我想要的是在单击按钮后激活效果。 //TS
@ViewChild('icono', { read: ElementRef })icono: ElementRef;
execEffect() {
let x = this.icono
x.nativeElement.classList.add('bounce')
}
//HTML
<img #icono src="../../assets/something.png" style="width:60px;" (click)="execEffect()"/>
【问题讨论】: