當(dāng)前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
seaJS使用教程
<!DOCTYPE html>
<html><head></head><body><span>body</span>
//通過鏈接引入seajs<<script src="https://cdn.bootcss.com/seajs/3.0.2/sea.js"></script>
//執(zhí)行seajs配置項(xiàng),目的方便后面使用別名<script src="./seajs-config-v1.js"></script> <script>
//alias為seajs-config-v1里面所代表的的一個(gè)模塊seajs.use(["alias"] ,function(a){var res = a.nameconsole.log(res)});</script></body>
</html>
seajs-config-v1.js代碼
seajs.config({"base": "./assets","alias": {"alias": "a"//alias就代表assets文件夾的a.js模塊} });a.js模塊代碼
define(function(require, exports, module) {var event = { // 對(duì)外提供接口name: 'a',doSomething: function() {console.log('do')}}module.exports = event });轉(zhuǎn)載于:https://www.cnblogs.com/huangxingyuan/p/8991704.html
總結(jié)