mirror of
https://github.com/jeecgboot/jeecg-boot.git
synced 2025-09-24 22:15:19 +00:00
前端和后端源码,合并到一个git仓库中,方便用户下载,避免前后端不匹配的问题
This commit is contained in:
37
jeecgboot-vue3/mock/demo/select-demo.ts
Normal file
37
jeecgboot-vue3/mock/demo/select-demo.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { MockMethod } from 'vite-plugin-mock';
|
||||
import { resultSuccess, baseUrl } from '../_util';
|
||||
|
||||
const demoList = (keyword, count = 20) => {
|
||||
const result = {
|
||||
list: [] as any[],
|
||||
};
|
||||
for (let index = 0; index < count; index++) {
|
||||
//根据搜索关键词做一下匹配
|
||||
let name = `选项${index}`;
|
||||
if(keyword && name.indexOf(keyword)!=-1){
|
||||
result.list.push({
|
||||
name: `选项${index}`,
|
||||
id: `${index}`,
|
||||
});
|
||||
}else if(!keyword){
|
||||
result.list.push({
|
||||
name: `选项${index}`,
|
||||
id: `${index}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
url: `${baseUrl}/select/getDemoOptions`,
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: ({ query }) => {
|
||||
const { keyword,count} = query;
|
||||
console.log("查询条件:", keyword);
|
||||
return resultSuccess(demoList(keyword,count));
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
Reference in New Issue
Block a user