Files
npm-tool/README.md
2023-03-06 23:30:58 +08:00

43 lines
830 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 工具包
### 通用方法类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}
```