如何从旧的dojo迁移到新的dojo AMD加载器?

时间:2013-04-25 09:37:43

标签: dojo require amd migrate

我想从旧的dojo.require加载器迁移到新的AMD加载器,所以我改变了这个:

        dojo.require("dojo._base.xhr");
        dojo.require("dojox.mobile.parser");
        dojo.require("dojox.mobile");
        dojo.require("dojox.mobile.ScrollableView");
        dojo.require("dojox.mobile.TabBar");
        dojo.require("dojox.mobile.TextBox");
        dojo.require("dojox.mobile.compat");
        dojo.require("dojox.mobile.deviceTheme");
        dojo.require("dojox.mobile.TabBarButton");
        dojo.require("dojox.mobile.View");
        dojo.require("dojox.mobile.Button");
        dojo.require("dojox.mobile.Switch");
        dojo.require("dojo.on");
        dojo.require("dijit.registry");
        dojo.require("dojo.aspect");
        dojo.require("dojo.ready");
        dojo.require("dojox.mobile.ListItem");
        dojo.require("dojo.dom");
        dojo.require("dojo.request");
        dojo.require("dojo.dom-construct");
        dojo.require("dojo.domReady!");
CODE

到此:

require(["dojo/_base/xhr","dojox/mobile/parser","dojox/mobile","dojox/mobile/ScrollableView","dojox/mobile/TabBar","dojox/mobile/TextBox","dojox/mobile/compat","dojox/mobile/deviceTheme","dojox/mobile/TabBarButton","dojox/mobile/View","dojox/mobile/Button","dojox/mobile/Switch","dojo/on","dijit/registry","dojo/aspect","dojo/ready","dojox/mobile.ListItem","dojo/dom","dojo/request","dojo/dom-construct","dojo/domReady!"],
    function(xhr,parser,mobile,ScrollableView,TabBar,TextBox,compat,deviceTheme,TabBarButton,View,Button,Switch,on,registry,aspect,ready,ListItem,dom,request){CODE})

是这样做的吗? 我有一些其他脚本文件,我简单加载如何使用新的AMD加载程序处理它们?

我对所有编程内容都很陌生,所以请对我软一点:)

1 个答案:

答案 0 :(得分:1)

试试来自sitepen的全新转换器。在此处阅读:http://www.sitepen.com/blog/2013/04/03/introducing-dojo-amd-converter/