1.1.1 • Published 2 years ago
cache-api v1.1.1
cache-api
cache data from display api.useful for working on the front end.
安装
npm install cache-api --save
使用
// 案例一
import CacheApi from 'cache-api';
import request from '@/utils/request'
export const getList = new CacheApi((data) => {
request({
url: 'user/list',
method: 'get',
data
})
})
// .vue
import { getList } from '@/api/user'
const data = {
current: 1,
pageSize: 10,
}
getList.send(data).then(res => {
})
getList.forceSend(data).then(res => {
})
getList.send(data, true).then(res => {
})
// 案例二
import { createCacheAPI } from 'cache-api';
import request from '@/utils/request'
const getList = (data) => {
request({
url: 'user/list',
method: 'get',
data
})
}
export const getListCache = createCacheAPI(getListRaw, {
filters: [res => res],
})
// .vue
import { sendCacheAPI } from 'cache-api'
import { getList } from '@/api/user'
const data = {
current: 1,
pageSize: 10,
}
sendCacheAPI("getList")(data).then(res => {
})
sendCacheAPI(getList)(data).then(res => {
})
sendCacheAPI(getList, true)(data).then(res => {
})
许可证
ISC © yokasu
1.1.1
2 years ago
1.1.0
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
0.2.14
4 years ago
0.2.13
4 years ago
0.2.12
4 years ago
0.2.11
4 years ago
0.2.10
4 years ago
0.2.9
4 years ago
0.2.8
4 years ago
0.2.7
4 years ago
0.2.6
4 years ago
0.2.5
4 years ago
0.2.4
4 years ago
0.2.3
4 years ago
0.2.2
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.25
4 years ago
0.1.24
4 years ago
0.1.23
4 years ago
0.1.22
4 years ago
0.1.21
4 years ago
0.1.20
4 years ago
0.1.19
4 years ago
0.1.18
4 years ago
0.1.17
4 years ago
0.1.16
4 years ago
0.1.15
4 years ago
0.1.14
4 years ago
0.1.13
4 years ago
0.1.12
4 years ago
0.1.11
4 years ago
0.1.10
4 years ago
0.1.9
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago