问题描述
我在 creatJS
上遇到问题,希望您能提供帮助。
I have a problem with creatJS
I hope you can help.
var stage = new createjs.Stage(canvas);
我收到此错误:
谢谢
推荐答案
我遇到了类似的问题-就我而言,我添加了 npm软件包(我在Laravel wabpack组合中使用了它)。似乎范围存在问题,因此我必须确保createjs是全局的。因此,您可以尝试执行以下操作:
I had a similar problem - in my case I added the createjs-module npm package for webpack (I use it in the Laravel wabpack mix). It appeared that there was an issue with the scope, so I had to ensure that createjs is global. So you can try to do the following:
-
安装npm模块(在控制台中)
Install the npm module (in the console)
npm install createjs-module --save
初始化createjs(在您的js文件中)
Initialize the createjs (in your js file)
this.createjs = {};
使createjs全局(在您的js文件中)
Make createjs global (in your js file)
window.createjs = this.createjs;
导入模块(在您的js文件中)
Import the module (in your js file)
require('createjs-module');
现在您可以照常使用它了: )
And now you can use it as usual :)
参考:
这篇关于我在CreateJS中收到错误:“未定义createjs”;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!