我正在尝试将 Bootbox 与 RequireJS 一起使用,但每次出现此错误时:
ReferenceError:未定义引导箱
我用依赖项配置了 RequireJS:
var
bowerLocal = "../../../bower_components/",
asstsLocal = "../../assets/";
requirejs.config({
paths: {
"jquery": bowerLocal + "jquery/dist/jquery.min",
"jquery.bootbox": bowerLocal + "bootbox/bootbox",
"jquery.bootstrap": bowerLocal + "bootstrap/dist/js/bootstrap.min",
"jquery.elevateZoom": bowerLocal + "elevatezoom/jquery.elevateZoom-2.2.3.min",
"jquery.maskedInput": bowerLocal + "jquery-maskedinput/dist/jquery.maskedinput.min"
},
/**
* Define as dependências de bibliotecas.
*/
shim: {
"jquery.bootstrap": {
deps: ["jquery"]
},
"jquery.elevateZoom": {
deps: ["jquery"]
},
"jquery.maskedInput": {
deps: ["jquery"]
},
"jquery.bootbox": {
deps: ["jquery", "jquery.bootstrap"],
exports: 'bootbox'
}
}
});
require(
["jquery", "jquery.bootstrap", "jquery.bootbox", "jquery.maskedInput", "jquery.elevateZoom"],
function (util) {
bootbox.alert("Hi");
}
...