[英]No define call function in Require.js
我在主干项目中使用Require.js加载jquery-menu-aim
和bootstrap
时出错。
这是我在main.js中定义的内容:
requirejs.config({
enforceDefine: true,
paths: {
//declare path jquery, backbone, underscore,and other library here....
"jquery-menu-aim" : "libs/jquery/jquery.menu-aim",
"bootstrap" : "libs/jquery/bootstrap.min"
},
shim: {
"jquery-menu-aim" : {
deps: ["jquery"] ,
exports: "Jquerymenuaim"
},
"bootstrap" : {
deps: ["jquery"] ,
exports: "Bootstrap"
}
}
});
错误:未捕获错误:对jquery-menu-aim没有定义调用http://requirejs.org/docs/errors.html#nodefine require.js:8未捕获错误:没有对引导程序http://requirejs.org/的定义调用文档/ errors.html#nodefine
当我在视图中定义它时。 我认为在Shim config中定义库可能是错误的,但在google中找不到。
任何帮助,将不胜感激。 谢谢。
您的Bootstrap填充程序绝对是错误的,因为Bootstrap没有定义名为Bootstrap
的符号。 这是我使用的:
bootstrap: {
deps: ["jquery"],
exports: "jQuery.fn.popover"
},
jQuery.fn.popover
方法是Bootstrap定义的。 如果在RequireJS加载Bootstrap之后不存在,则表明Bootstrap没有加载。
您的jquery.menu-aim填充程序同样错误。 查看代码 ,我看到它是一个jQuery插件。 您应该更改垫片以检查它添加到jQuery的功能。 jQuery.fn.menuAim
看起来不错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.