我无法使用fabric将图像添加到画布。在2.4.6版的fabric中,图像或imagefromurl。
<html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.4.6/fabric.js"></script> </head> <body> <canvas id="c" width=400 height=300></canvas> </body> </html> <script> var canvas = new fabric.Canvas('c'); var url = 'driver.png'; var imgInstance = new fabric.Image(url, { left: 100, top: 100, width: 200, height: 200 }); canvas.add(imgInstance); </script>