// 该写法为了满足多条件下的 CommonJs,Node.js, window,layui
(function (name, factory) {
// 检测上下文是否为AMD或者CMD
var hasDefine = typeof define === "function",
// 检查上下文环境是否为Node
hasExports = typeof module !== 'undefined' && module.exports,
hasLayui = this.layui && layui.define;
if (hasDefine) {
// AMD 环境或者 CMD环境
define(factory);
} else if (hasExports) {
// 定义为普通的Node模块
module.exports = factory();
} else if (hasLayui) {
// 是否为layui模块
layui.define(['jquery'], function (exports) {
exports('com', factory());
});
} else {
// window对象
this[name] = factory();
}
}
)('com', function () {
"use strict";
var Com = function Com(params) {
};
Com.prototype.info = function () {
const info = {
version: 'v-1.0.1',
description: 'Com只是一个测试兼容多种规范的样例!',
author: 'Mc.Sumi',
date: '2018-11-01 15:00:00'
}
console.log(`当前Com的详细介绍:\n ${info} `);
return info;
}
return new Com(); // 返回构造
});
(function (root, factory) {
typeof define === 'function' && define.amd ? define(factory) :
typeof module === 'object' && module.exports ? module.exports = factory() :
typeof root.layui === 'object' && layui.define ? layui.define(function (exports) {
exports('Vue', factory())
}) : root.Vue = factory();
}(this, function () {
'use strict';
return Vue;
}));
(function (layui, window, factory) {
if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
// 支持 CommonJS
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// 支持 AMD
define(factory);
} else if (window.layui && layui.define) {
//layui加载
layui.define(['jquery'], function (exports) {
exports('cue', factory());
});
} else {
window.cue = factory();
}
})(typeof layui == 'undefined' ? null : layui, window, function () {
'use strict';
var $ = window.$ || window.layui && window.layui.jquery,
sue = {
version: '1.0.1',
};
// 内置公共方法
var Common = function Common() {
}
var common = new Common();
// 对外提供
var Cue = function Cue(params) {
this.version = sue.version;
};
Cue.prototype.test = function (text, fun) {
console.log(text);
}
return new Cue();
})
(function (global, factory) {
typeof define === 'function' && define.amd ? define(['exports'], factory) :
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof global.layui === 'object' && layui.define ? layui.define(function (exports) {
exports('echarts', factory(exports))}) : (factory((global.echarts = {})));
}(this, (function (exports) { 'use strict';
return exports;
})));