nce-utils-test v0.1.0
nce-utils
nce 项目公用的工具类
地址
http://47.93.124.2/-/web/detail/nce-utils
安装
可以在浏览器中直接使用JavaScript文件 nce-utils.umd.js或通过npm方式安装。
浏览器直接加载
会在全局环境添加NceUtils对象:
<script src='path/to/nce-utils.umd.js'></script>
npm方式
nce-utils发布在世纪高通的镜像源。使用时需要先修改npm的镜像源:
npm config set registry http://47.93.124.2
安装:
npm install nce-utils -S
使用
示例
通过script标签方式引入:
<script>
let date = NceUtils.dateTool.getFormatDate();
console.info(date);
</script>
ES module:
import { dateTool } from "nce-utils";
let date = dateTool.getForamtDate();
console.info(date);
模块说明
AES generatekey随机生成指定数量的16进制key encrypt加密 * decrypt解密
AES128 uuid decrypt encrypt getMixedText * getUnMixedText
dateTool 日期格式化 formatDate getCurrentDayZeroTime getDateStr getCurrentTime * getFormatDate
featureMeta 地理要素 coordEach coordReduce propEach propReduce featureEach featureReduce coordAll geomEach geomReduce feature flattenEach flattenReduce
loadTools loadScript loadScriptCode loadScripts removeScript removeScripts loadStyle loadStyleCode loadStyles removeStyle removeStyles
MapApiLoader 加载地图Api的类 tools removeAllApi load2dBaseApi loadPluginApi load3dBaseApi loadCDNApi
```javascript import { MapApiLoader } from "nce-utils"; // 创建实例时需要传入url参数 const mapApiLoader = new MapApiLoader({ APP_JS_2D_API_URL: "", APP_JS_3D_API_URL: "", APP_JS_API_PLUGINS_URL: "", APP_JS_API_CDN_URL: "", }); console.info(mapApiLoader.tools.loadPluginApi); ```
message * 封装element-ui的message
```js // main.js import { message } from "nce-utils"; Vue.prototype.$message = message; // 使用 this.$message({ message: res.msg, type: "success", }); ```
storageUtil setSession getSession removeSession setLocal getLocal removeLocal
transformUnit changeSizeUnit 字节单位向上转换 changeTimeUnit 秒数转为时长字符串
uuidUtil getUuid getUuid_Eight loadjscssfile removejscssfile createjscssfile replacejscssfile
validator 校验 validateUsername validateMail validatePass validateCheckPass validatePhone validateServicename
common
- getMenuByRouter
- joinParamToUrl
- debounce 函数防抖
2 years ago