gpt4 book ai didi

javascript - Tracker afterFlush 函数出现异常 : fabric. Canvas 不是构造函数

转载 作者:行者123 更新时间:2023-12-03 10:43:04 29 4
gpt4 key购买 nike

我正在通过 meteor 开发 fabric.js 应用程序。我已包含文件 http://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.4.0/fabric.min.js在项目中,我尝试定义一个简单的 Canvas ,如下所示,

Template.formatter.rendered = function () {

var canvas = new fabric.Canvas('fabriccanvas'); //<-- error Line
canvas.add(new fabric.Circle({ radius: 30, fill: '#f55', top: 100, left: 100 }));

canvas.selectionColor = 'rgba(0,255,0,0.3)';
canvas.selectionBorderColor = 'red';
canvas.selectionLineWidth = 5;


}

但是我收到错误Tracker afterFlush 函数异常:fabric.Canvas 不是构造函数。我对这些环境非常陌生,非常感谢各位专家为解决这个问题提供的任何帮助:)谢谢

最佳答案

确保您已将脚本放入 /client/compatibility

This folder is for compatibility JavaScript libraries that rely on variables declared with var at the top level being exported as globals. Files in this directory are executed without being wrapped in a new variable scope. These files are executed before other client-side JavaScript files.

来自 doc meteor structuringyourapp

关于javascript - Tracker afterFlush 函数出现异常 : fabric. Canvas 不是构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28689578/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com