<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script>
        var dojoConfig = {
            packages: [{

                //包名(称为包更容易理解,包是一系列模块的集合);
                name: "A",
                //包映射的路径(在此设置为根目录下的js/modules之下;
                location: location.pathname.replace(/\/[^/]+$/, "") + "/js/modules"

            }]
        };
    </script>
    <script src="http://js.arcgis.com/3.9/"></script>
    <script type="text/javascript">
        require(["A/demo"], function (demo) {
            demo.f();
        });
    </script>
</head>
<body>

</body>
</html>

模块代码(demo.js):

/*此模块没有依赖项,只做简单的测试*/

define(function () {
    var a = {
        f: function () {
            alert("f()执行!");
        }
    };
    return a;/*返回一个对象*/
})

目录结构图:

dojoConfig包的配置(7/26号夜)

相关文章:

  • 2021-07-30
  • 2021-10-13
  • 2021-10-07
  • 2021-10-01
  • 2022-01-20
  • 2022-12-23
  • 2021-04-26
  • 2021-07-19
猜你喜欢
  • 2021-07-24
  • 2021-06-05
  • 2021-10-06
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-07-28
相关资源
相似解决方案