标签:fun 分享 def sse html ali 模块 otc span
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span>body</span>
//通过链接引入seajs
<<script src="https://cdn.bootcss.com/seajs/3.0.2/sea.js"></script>
//执行seajs配置项,目的方便后面使用别名
<script src="./seajs-config-v1.js"></script>
<script>
//alias为seajs-config-v1里面所代表的的一个模块
seajs.use(["alias"] ,function(a){
var res = a.name
console.log(res)
});
</script>
</body>
</html>
seajs.config({
"base": "./assets",
"alias": {
"alias": "a"//alias就代表assets文件夹的a.js模块
}
});
define(function(require, exports, module) {
var event = { // 对外提供接口
name: ‘a‘,
doSomething: function() {
console.log(‘do‘)
}
}
module.exports = event
});
标签:fun 分享 def sse html ali 模块 otc span
原文地址:https://www.cnblogs.com/huangxingyuan/p/8991704.html