require.js错误(topojson未加载)

时间:2015-02-27 16:44:56

标签: javascript requirejs topojson

任何人都可以帮我理解/修复此错误吗?

未捕获的ReferenceError:未定义topojson

我是requireJS的新手,并不完全理解它。

提前谢谢!

require.config({
  paths: {
  	d3: "//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min",
  	geo: "//d3js.org/d3.geo.projection.v0.min",
  	topo: "//d3js.org/topojson.v1.min"
 },
 shim: {
 	geo: {
 		deps: ["d3"]
 	},
 	topo:{
 		deps: ["d3","geo"]
 	}
 }

 
});

require(["d3","geo","topo"],function(){
	$(document).ready(RecruitingData.ondomready);
	$(document).bind('framework.resize',RecruitingData.scalescharts());
	$(document).bind('framework.resize',RecruitingData.scalescharts1());	
	$(document).bind('framework.resize',RecruitingData.linechart());	
	$(document).bind('framework.resize',RecruitingData.mapchart());	
})

1 个答案:

答案 0 :(得分:3)

我对require.js一无所知,但在查看api时,您错过了require回调的参数:

require(["d3","geo","topo"],function(d3,geo,topojson){
    // you can now use topojson!
});

示例here