mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-27 23:18:38 +08:00
41e6d94b3b
添加ApiSelect的本地搜索和远程搜索例子
29 lines
603 B
TypeScript
29 lines
603 B
TypeScript
import { MockMethod } from 'vite-plugin-mock';
|
|
import { resultSuccess } from '../_util';
|
|
|
|
const demoList = (keyword) => {
|
|
const result = {
|
|
list: [],
|
|
};
|
|
for (let index = 0; index < 20; 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 } = query;
|
|
console.log(keyword);
|
|
return resultSuccess(demoList(keyword));
|
|
},
|
|
},
|
|
] as MockMethod[];
|