【发布时间】:2018-10-19 08:52:38
【问题描述】:
我正在尝试使用 Typescript 修改伪元素的高度。
我的 IDE (vscode) 中出现以下错误
这是我的代码。
// select element
let el: HTMLElement = document.getElementById('filter-container');
// style the height of psydo element
el.pseudoStyle("before", "height", newHeight);
...
【问题讨论】:
-
HTMLElement接口中没有pseudoStyle属性。这就是它在 IDE 中引发错误的原因。你可以这样做let el: any = document.getElementById('filter-container'); -
@BasavarajBhusani 我试过任何一个,它给出了错误 el.pseudoStyle is not a function
-
你是在 VS 代码 IDE 中还是在运行时遇到这个错误?
-
@BasavarajBhusani 在运行时
标签: javascript angular typescript ionic3 pseudo-element