feat:添加组件实例

This commit is contained in:
zhangchuanlong
2022-03-07 12:18:42 +08:00
parent 8bcbcac531
commit 5fcc47816c
10 changed files with 1251 additions and 839 deletions

39
src/api/post/index.js Normal file
View File

@@ -0,0 +1,39 @@
import { defAxios } from '@/utils/http'
export function getPosts(data = {}) {
return defAxios({
url: '/posts',
method: 'get',
data,
})
}
export function getPostById({ id }) {
return defAxios({
url: `/post/${id}`,
method: 'get',
})
}
export function savePost(id, data = {}) {
if (id) {
return defAxios({
url: `/post/${id}`,
method: 'put',
data,
})
}
return defAxios({
url: '/post',
method: 'post',
data,
})
}
export function deletePost(id) {
return defAxios({
url: `/post/${id}`,
method: 'delete',
})
}