feat: 补充mock接口

Former-commit-id: 9e1a5128d6ac9d8161240d224324b79c5e4f3dcc
This commit is contained in:
hxr
2023-08-09 07:22:34 +08:00
parent 8c60fb2a23
commit 7725bd0792
4 changed files with 318 additions and 0 deletions

36
mock/dict.ts Normal file
View File

@@ -0,0 +1,36 @@
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/api/v1/dict/:code/options",
method: "get",
response: ({ url }) => {
const typeCode = url.match(/\/api\/v1\/dict\/(\w+)\/options/)[1];
let list = null;
if (typeCode == "gender") {
list = [
{
value: "1",
label: "男",
},
{
value: "2",
label: "女",
},
{
value: "0",
label: "未知",
},
];
}
return {
code: "00000",
data: list,
msg: "一切ok",
};
},
},
] as MockMethod[];