JQ - 解决 JQ中 carvas.getContext('2d') 报错 canvas.getContext is not a function

在JQ中 carvas.getContext('2d'),报错 Uncaught TypeError: canvas.getContext is not a function

 

var canvas = $('canvas');
var context = canvas.getContext('2d');
// 改为
var canvas = $('canvas');
var context = canvas.get(0).getContext('2d');

 

posted @ 2021-02-01 11:44  sanyekui  阅读(5491)  评论(0编辑  收藏  举报