VScode 智能感知在 HTML 5“canvas”元素上工作是否存在问题?Intellisense 不提供自动完成支持
var canvas = document.getElementById("canvas")
canvas.getC... /*there is no .getContext("2d")*/
Run Code Online (Sandbox Code Playgroud)
小智 9
使用 JSDoc@type获取canvas元素:
/** @type {HTMLCanvasElement} */
const c = document.getElementById('canvas');
Run Code Online (Sandbox Code Playgroud)
查看更多:在 HTML Canvas 的 VS Code 中获取 IntelliSense作者:Nathan Vaughn