vue-vben-admin/mock/demo/select-demo.ts

29 lines
641 B
TypeScript
Raw Normal View History

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