我想从旧的 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 加载程序处理它们?
我对所有编程的东西都很陌生,所以请对我温柔:)