feat: 新增 Element Plus Table 示例
This commit is contained in:
57
src/api/table.ts
Normal file
57
src/api/table.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { request } from "@/utils/service"
|
||||
|
||||
interface ICreateTableDataApi {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
interface IUpdateTableDataApi {
|
||||
id: number
|
||||
username: string
|
||||
password?: string
|
||||
}
|
||||
|
||||
interface IGetTableDataApi {
|
||||
/** 当前页码 */
|
||||
currentPage: number
|
||||
/** 查询条数 */
|
||||
size: number
|
||||
/** 查询参数 */
|
||||
username?: string
|
||||
phone?: string
|
||||
}
|
||||
|
||||
/** 增 */
|
||||
export function createTableDataApi(data: ICreateTableDataApi) {
|
||||
return request({
|
||||
url: "table",
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/** 删 */
|
||||
export function deleteTableDataApi(id: number) {
|
||||
return request({
|
||||
url: `table/${id}`,
|
||||
method: "delete"
|
||||
})
|
||||
}
|
||||
|
||||
/** 改 */
|
||||
export function updateTableDataApi(data: IUpdateTableDataApi) {
|
||||
return request({
|
||||
url: "table",
|
||||
method: "put",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/** 查 */
|
||||
export function getTableDataApi(params: IGetTableDataApi) {
|
||||
return request({
|
||||
url: "table",
|
||||
method: "get",
|
||||
params
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user