因为js是弱类型的语言。
vscode无法确定document.getElementsByClassName("frame")[0]返回的具体是什么元素。
自然没办法给出具体元素的属性提示了。
可以在赋值的上一行用jsDoc注释标出frame变量的类型
/** @type {HTMLFrameElement} */
let frame = document.getElementsByClassName("frame")[0];
这样就能解决无代码提示的问题了
因为js是弱类型的语言。
vscode无法确定document.getElementsByClassName("frame")[0]返回的具体是什么元素。
自然没办法给出具体元素的属性提示了。
可以在赋值的上一行用jsDoc注释标出frame变量的类型
/** @type {HTMLFrameElement} */
let frame = document.getElementsByClassName("frame")[0];
这样就能解决无代码提示的问题了