//设置requireJS配置文件(fig.js):
require.config({
baseUrl : "/", //设置加载的模块的共有基目录(可选)
paths : {
jquery : "lib/jquery/jquery-1.12.4.min",
cookie : "lib/jquery_plugins/jquery.cookie",
zoom : "lib/jquery_plugins/jquery.elevateZoom-3.0.8.min",
carousel : "lib/jquery_plugins/jquery.linCarousel",
template : "lib/artTemplate/template",
load : "js/loadHeaderFooter"
},
shim : {//对于非AMD规范的模块用shim声明依赖
carousel : {
deps : ["jquery"]
},
zoom : {
deps : ["jquery"]
}
}
});
//引用模块(index.js):
require(["config"], function(){
require(["jquery", "template", "load"], function($, template){
$.getJSON("/mock/list.json", function(data){
data = {list : data.res_body.data};
let html = template("list_template", data);
$(".list").html(html);
});
});
});