html:配置和使用

seajs.config({

alias:{

'jq' : 'jquery-1.12.1.js'

}

})


seajs.use(['./js/computer'],function(a){

a.say();

})


js中模块化

define(function(require, exports,module){

require('jq');

exports.say = function(){

console.log($)

// $('#foot').append('<li>sade</li>')

$.ajax({

type:"get",

url:"data/1.json",

async:true,

success:function(e){

console.log(e);

for (var i = 0; i < e.shop_data.length; i++) {

// e.shop_data[i]

$('#foot').append('<li><img / ><p></p><p></p></li>');

$('#foot').children().eq(i).find('img').attr({'src' : e.shop_data[i].shop_ico});

$('#foot').children().eq(i).find('p').eq(0).text(e.shop_data[i].shop_name);

$('#foot').children().eq(i).find('p').eq(1).text(e.shop_data[i].shop_desc);

}


}

});

}

})

文件在hbuilder打开