1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-10 19:10:25 +08:00
Files
paper-manager/frontend/vben/mock/demo/select-demo.ts
2023-03-11 18:07:45 +08:00

29 lines
639 B
TypeScript

import { MockMethod } from 'vite-plugin-mock'
import { resultSuccess } from '../_util'
const demoList = (keyword: string, count = 20) => {
const result = {
list: [] as any[],
}
for (let index = 0; index < count; index++) {
result.list.push({
name: `${keyword ?? ''}选项${index}`,
id: `${index}`,
})
}
return result
}
export default [
{
url: '/basic-api/select/getDemoOptions',
timeout: 1000,
method: 'get',
response: ({ query }) => {
const { keyword, count } = query
console.log(keyword)
return resultSuccess(demoList(keyword, count))
},
},
] as MockMethod[]