JavaScript/typescript/error:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
 
(未显示同一用户的1个中间版本)
第80行: 第80行:
const rootContainer = document.getElementById('root');
const rootContainer = document.getElementById('root');
rootContainer && (rootContainer.className = 'blur');</syntaxhighlight>
rootContainer && (rootContainer.className = 'blur');</syntaxhighlight>
* Property 'style' does not exist on type 'Element' <syntaxhighlight lang="javascript" inline>
document.getElementsByClassName('section_content_icon_box_style')[0].style.background = `conic-gradient(#4D4D57 ${45*index}deg, transparent ${45*index}deg ${180 - 45*index}deg, transparent 180deg)`;
</syntaxhighlight>
*# <syntaxhighlight lang="javascript" inline>
(document.getElementsByClassName('section_content_icon_box_style') as HTMLCollectionOf<HTMLElement>)[0].style.background = `conic-gradient(#4D4D57 ${45*index}deg, transparent ${45*index}deg ${180 - 45*index}deg, transparent 180deg)`;
</syntaxhighlight>
* Type 'undefined' is not assignable to type
: 加类型断言