gpt4 book ai didi

javascript - Declare is not defined 错误在 DOJO

转载 作者:行者123 更新时间:2023-11-30 17:51:44 24 4
gpt4 key购买 nike

我在使用 FireBug 打开我的应用程序时遇到错误“Declare is not define error”。我正在使用 DOJO 框架并想开始编写代码。请帮我找出问题所在。

define(["dojo/_base/lang",
],

function (lang){
return declare ("app.Sample",{
testM : function test(){
alert('hi');
}
}
);
}
);

<html>
<head>
<link rel="stylesheet" href="src/dijit/themes/claro/claro.css" media="screen">
</head>
<script>
var dojoConfig = {baseUrl:"src" ,packages: [{ name: "dojo",
location: "dojo" },{ name: "dijit", location: "dijit" },{ name: "dojox", location: "dojox" },{ name: "app", location: "app"},],
parseOnLoad: true, useXDomain:true, async: true, debugAtAllCosts: true};
</script>
<script src="src/dojo/dojo.js"></script>
<body>
<script type="text/javascript">
require([
'app/Sample']);
</script>
</body>
</html>

最佳答案

我发现了这个问题。我必须导入 dojo/_base/declare。我的代码中缺少这一点。

关于javascript - Declare is not defined 错误在 DOJO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18866085/

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