gt-mp-utils
v1.1.1
Published
小程序组件库
Downloads
5
Readme
小程序utils库
utils开发
拉取代码后,
# 打开小程序utils项目
cd packages/gt-mp-utils
# 安装依赖
npm i
开发规范:
1)提供的工具函数,都需要添加注释说明和使用demo;
2)建议使用单方法单文件的形式,方便使用时快速查找util;
3)建议使用ts编写;
utils 自测
部分小程序方法涉及到小程序原生能力,可在小程序环境单独测试
使用jest 方式,为每个方法创建单测用例;
单测文件添加至/test 文件下;
运行单测命令:
npm run test
注释和单测文件可用copilot生成
测试完成后,发布npm包
- 发布前准备:组内代码cr并跑通单测;
- 运行npm run build 生成lib文件;
- 修改包版本后发布
小程序封装方法包括
- 小程序业务通用方法(string、time、url、 dataType、functions...)
- 小程序的系统能力封装(webSocketstring、innerAudioContexttime、systemInfourl、授权信息)
- 小程序通用业务方法封装(loginUtils、sourceToLeads)
小程序-Utils文档: 已有方法汇总
https://wiki.baijia.com/pages/viewpage.action?pageId=216185954