0.1.2 • Published 2 years ago
welinkin-core v0.1.2
welinkin core
提供通用方法。
使用
yarn add welinkin-core
Function
server(config: AxiosRequestConfig, loading: boolean = true)
通用api调用
import { server } from 'welinkin-core';
...
await server({
url: 'url',
data: {}
})
...
waitServer(cacheKey: string | number | undefined, axiosOptions: AxiosRequestConfig, next: Function)
等待调用成功后,一并返回。
import { waitServer } from 'welinkin-core';
...
// cacheKey 存在时,相同cacheKey只会调用一次api
waitServer('cacheKey',{
url: 'url',
data: {}
}, result => {
// result 返回结果
})
...
useModel 获取模型
获取模型定义。
import { useModel } from 'welinkin-core';
... const [columns = []] = useModel('modelUrl', 'WorkOrder'); ...
```diff
+ import { useModel } from 'welinkin-core';
- const { columns } = units.useModel({ modelUrl: 'WorkOrder' })
+ const [columns = []] = useModel('modelUrl', ['WorkOrder']);