按照http://
seajs.org/docs/#quick-start 这上面的配置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd"><html lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title></title><script charset="utf-8" id="seajsnode"src="
http://static.alipayobjects.com/seajs/1.3.1/??sea.js,plugin-combo.js"></script>
<script>
seajs.config({
// 配置插件
plugins: ['shim'],
// 配置别名
alias: {
// 配置 jquery 的 shim 配置,这样我们就可以通过 require('jquery') 来获取 jQuery
'jquery': {
src: './js/jquery-1.7.1.min.js',
exports: 'jQuery'
}
}
});
define(function(require, exports, module) {
var $ = require('jquery');
});
</script>
</head><body><button id='demo' > demo</button>
<script type="text/javascript">
seajs.use(['jquery'],function($){
console.log($);
$('#demo').click(function(){
alert('ok');
});
});
</script>
</body></html>
firebug控制台报错 Error: $ is not a function