2
我试图在Require应用程序中使用c3.js
和d3.js
。我application.html.erb
看起来如下:Rails,RequireJS,C3.js:c3未定义
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= yield(:title) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= stylesheet_link_tag params[:controller] %>
<%= csrf_meta_tags %>
</head>
<body>
<div>
<%= yield %>
</div>
<%= requirejs_include_tag params[:controller] %>
</body>
</html>
电流调节器是instructor
和得到成功加载该文件,instructor.js
如下所示:
instructor.js
require(["jquery", "modules/d3.min", "modules/c3.min"], function($, d3, c3)
{
console.log(d3);
console.log(c3);
});
现在,在运行应用程序时没有错误,但未定义c3
。这里是控制台输出:
控制台
Object {version: "3.4.13", ascending: function, descending: function, min: function, max:function…} // instructors.js:3
undefined // instructors.js:4
所以d3.js被载入罚款,但c3.js是不确定的。我不明白这里发生了什么问题。请帮忙。
谢谢!