require.js error (topojson not loading)

此生再无相见时 提交于 2019-12-11 11:32:44

问题


Can anyone help me understand/fix this error?

Uncaught ReferenceError: topojson is not defined

I am new to requireJS and don't fully understand it.

Thank you in advance!

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:


I don't know anything about require.js but looking at the api, you are missing the arguments to your require callback:

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

Example here.



来源:https://stackoverflow.com/questions/28770061/require-js-error-topojson-not-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!