日期:2014-05-16  浏览次数:20379 次

dojo技术问题
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojo/dojo.js"></script>
<script type="text/javascript">
require([
"dojo/_base/declare",
"dojo/request/script"
], function (declare,script) {
    declare("OrderMap", null, {
        map: null,
        sellerUsername: null,
        constructor: function (map, sellerUsername) {
            this.map = map;
            this.sellerUsername = sellerUsername;
        },
});
}
);

    var map="1111";
    var orderMap = new OrderMap(map, sellerUsername);
    //orderMap.show();
</script>


运行时出现OrderMap未定义 错在哪里?
dojo

------解决方案--------------------
1,constructor定义的结尾多了个,
2.你的OrderMap实例不在作用域内.
你看这个示例url:http://dojotoolkit.org/reference-guide/1.9/dojo/_base/declare.html

require(["dojo/_base/declare"], function(declare){
  var A = declare(null, {
    constructor: function(){ console.log("A"); }
  });

  var B = declare(A, {
    constructor: function(){ console.log("B"); }
  });

  var C = declare(B, {
    constructor: function(){ console.log("C"); }
  });

  new C();
});