Directly on the code
W file
<?xml version= "1.0" encoding= "UTF-8"?
;
<div xmlns= "http://www.w3.org/1999/xhtml" xid= "window" class= "window" component= "$UI/system/ Components/justep/window/window "design=" Device:mobile ">
<div component=" $UI/system/ Components/justep/model/model "xid=" model "/>&NBSP;
<a component= "$UI/system/components/justep/button/button"
class= "btn Btn-default "onclick=" Importinnerbtnclick "
<i xid=" I1 "></I>
< Span xid= "Span1" > Load UI2, AMD-compliant file </span>
</a>
<a component= "$UI/system/ Components/justep/button/button " class=" btn Btn-default "
label=" into the extranet, AMD-compliant files "xid=" Importoutterbtn "onclick=" Importoutterbtnclick ",
<i xid=" I2 "></I>
<span xid= "span2" > On-board, AMD compliant file </span>
</a>
</d
JS file
Define (function (require) {
var $ = require ("jquery");
var justep = require ("$UI/system/lib/justep");
var Model = function () {
This.callparent ();
};
Model.prototype.importinnerbtnclick=function (event) {
Files that comply with AMD specifications, loaded into UI2
var path= "./amd2";
Require ([Path],function (m) {
M.FNOFAMD2 ();
});
}
Model.prototype.importoutterbtnclick=function (event) {
var path= "Http://localhost:8080/cn/wp-content/uploads/2015/04/outterAMD2.js"
Require ([Path],function (m) {
M.FNOFOUTTERAMD2 ();
})
}
return Model;
});
JS files that need to be referenced
Define
function (require) {
return{
Fnofamd2:function () {
Alert ("Hello AMD2");
}
};
});
There will be two buttons in the program
Reference to external JS file successfully referenced the network JS file failed
HTML5 loading JS Reference