我遇到错误
Property 'duni' has no initializer and is not definitely assigned in the constructor.ts(2564)
在下面的行
@ViewChild('bhondu') duni: ElementRef<HTMLTableDataCellElement>;
?
在其他我使用this.duni.nativeElement
Give的地方使用breaks代码将其设置为可选Object is possibly 'undefined'.ts(2532)
。如何在不更改配置文件中任何属性的情况下解决此错误?
使用非空断言运算符
@ViewChild('bhondu') duni!: ElementRef<HTMLTableDataCellElement>;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句