gpt4 book ai didi

javascript - require.js 错误(topojson 未加载)

转载 作者:行者123 更新时间:2023-11-30 12:27:42 24 4
gpt4 key购买 nike

谁能帮我理解/修复这个错误?

未捕获的 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());
})

最佳答案

我对 require.js 一无所知,但查看 api,您缺少 require 回调的参数:

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

示例 here .

关于javascript - require.js 错误(topojson 未加载),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28770061/

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