perf:完善readme

This commit is contained in:
yz
2023-03-06 23:30:58 +08:00
parent 96f83612a1
commit 3b0f1efae1
3 changed files with 46 additions and 2 deletions

42
README.md Normal file
View File

@@ -0,0 +1,42 @@
## 工具包
### 通用方法类Common.js
```js
import {Common} from "@tiesheng/npm-tool";
Common.isEmpty("tet")
```
### 网络请求类HttpUtil
```js
import {HttpUtil} from "@tiesheng/npm-tool";
// 全局配置
HttpUtil.setConfig({
encryptBody: true, // 加密发送数据默认加密秘钥WmdUzPJXbngVNiaSsQrihg==(具体秘钥咨询后台开发人员)
});
HttpUtil.post("http://localhost:8080",{key:"111",value:"2222"}).then(console.log);
// 这里Promise返回的数据只有data不在包含code等其他字段。
// Hello World!
```
### 存储类Storage
```js
import {Storage} from "@tiesheng/npm-tool";
// save方法可以直接保存对象
Storage.save("keyVal", {key: 111, val: 2222});
let obj = Storage.get("keyVal");
console.log(obj);
// log
// {key: 111, val: 2222}
```

View File

@@ -1,9 +1,13 @@
const Common = require('./src/utils/Common')
const Storage = require('./src/utils/Storage')
const crypto = require('./src/utils/Crypto')
const SM4 = require('./src/utils/SM4')
const HttpUtil = require('./src/https/HttpUtil')
module.exports = {
HttpUtil,
Common,
Storage,
SM4,
crypto,
}

View File

@@ -133,8 +133,6 @@ async function post(url, data = {}) {
newData = {...data};
}
console.log(newData);
return req(url, {method: 'POST', data: newData});
}