zoukankan      html  css  js  c++  java
  • dojoConfig包的配置(7/26号夜)

    主页代码:

    <!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;/*返回一个对象*/
    })

    目录结构图:

  • 相关阅读:
    3.21上午
    3.17下午
    2017.4.14-morning
    2017.4.13-afternoon
    2017.4.13-morning
    2017.4.12-afternoon
    2017.4.12-morning
    2017.4.11-afternoon
    2017.4.11-morning
    2017.4.10-afternoon
  • 原文地址:https://www.cnblogs.com/tinaluo/p/7237291.html
Copyright © 2011-2022 走看看