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"/>
<H1 xid= "H11" style= "Text:align:center;" >h1
<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 files </span>
</a>
<a component= "$UI/system/components/justep/button/button" class= "btn Btn-default"
Label= "Load extranet, files in accordance with AMD specifications" Xid= "importoutterbtn" onclick= "Importoutterbtnclick" >
<i xid= "I2" ></i>
<span xid= "span2" > Load extranet, AMD compliant files </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 under load 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");
}
};
});
Two buttons will appear in the program
Reference to external JS file successfully referenced the network JS file failed
HTML5 loading JS Reference