canvas 方法参数智能提示

 

在代码前面添加  /** @type {HTMLCanvasElement} */

 window.onload = function () {
        /** @type {HTMLCanvasElement} */
        const canvas = document.getElementById("canvas")
        canvas.width = 800
        canvas.height = 600;
        const context = canvas.getContext('2d');
        context.fillStyle = '#fff';
        context.fillRect(0, 0, 800, 600);
    }

  

posted @ 2020-06-04 17:29  第一神坑  Views(654)  Comments(0Edit  收藏  举报