typescript类型Element转化为HTMLElement
在使用document.querySelector获取元素时,获取到的类型是Element类型,而我们需要用到 HTMLElement 的属性,就要进行类型转换(convertion)。
document.querySelector<HTMLElement>('.panel-container').offsetWidth
1
上次更新: 2023/12/16, 09:22:46