简体   繁体   中英

Declare is not defined error in DOJO

I am getting the error "Declare is not define error" while opening my application with FireBug. I am using DOJO framework and want to started writing the code. Please help me to find the issue.

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>

I found this problem. I have to import dojo/_base/declare . That was missing in my code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM