问题描述
我正在尝试为TR动态设置css属性。 在单击TD的@HostListener中,通过.parentElement获取TR。 我想将.css类中定义的css属性分配给我的TR,而不是obj.parentElement.bgColor =“#003399”;
@HostListener('click',['$event'])
onClick(event: any) {
const obj = event.target.parentElement.id;
obj.parentElement.children[i].bgColor = "red";
}
我想将setBgColor属性分配给TR类,而不是编写obj.parentElement.children [i] .bgColor =“ red”。
test.css
.setBgColor {
background-color: red !important;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)