在Dojo Toolkit中的包配置中定义依赖关系

时间:2017-11-23 18:34:24

标签: jquery twitter-bootstrap dojo

我可以将jQuery定义为Bootstrap js的依赖项,以便在Bootstrap之前加载吗?例如:

 var dojoConfig = {
    async: true,
    baseUrl:'/',
    packages: [
      {name: "dojo", location: "lib/dojo"},
      {name: "dijit", location: "lib/dijit"},
      {name: "dojox", location: "lib/dojox"},
      {name: "jquery", location: "lib/jquery", main: "jquery-3.1.1.min"},
      {name: "bootstrap", location: "lib/bootstrap", main: "bootstrap.min"}
    ]

  };

1 个答案:

答案 0 :(得分:0)

模块将作为脚本添加到文档中,其顺序与在require函数中使用它们的顺序相同。例如:

require(["jquery","bootstrap"], function (jquery, bootstrap) {
            //some code here
        });

将生成以下内容:

...
<body>
<script type="text/javascript" charset="utf-8" src="path_to_jquery"></script>
<script type="text/javascript" charset="utf-8" src="path_to_bootstrap"></script>
...
</body>

希望你问的是什么。