diff --git a/src/pages/list/mock/index.ts b/src/pages/list/mock/index.ts new file mode 100644 index 00000000..733e9a0d --- /dev/null +++ b/src/pages/list/mock/index.ts @@ -0,0 +1,6 @@ +import { DefaultOptionType } from 'antd/es/select'; + +export const categoryOptions: DefaultOptionType[] = Array.from({ length: 12 }).map((_, index) => ({ + value: `cat${index + 1}`, + label: `类目${index + 1}`, +})); diff --git a/src/pages/list/search/applications/index.tsx b/src/pages/list/search/applications/index.tsx index 6aeefa8c..041e9893 100644 --- a/src/pages/list/search/applications/index.tsx +++ b/src/pages/list/search/applications/index.tsx @@ -14,7 +14,7 @@ import TagSelect from './components/TagSelect'; import type { ListItemDataType } from './data.d'; import { queryFakeList } from './service'; import useStyles from './style.style'; -const { Option } = Select; +import { categoryOptions } from '../../mock'; export function formatWan(val: number) { const v = val * 1; if (!v || Number.isNaN(v)) return ''; @@ -95,18 +95,9 @@ export const Applications: FC> = () => { > - 类目一 - 类目二 - 类目三 - 类目四 - 类目五 - 类目六 - 类目七 - 类目八 - 类目九 - 类目十 - 类目十一 - 类目十二 + {categoryOptions.map((category) => ( + {category.label} + ))} @@ -120,9 +111,13 @@ export const Applications: FC> = () => { maxWidth: 200, width: '100%', }} - > - - + options={[ + { + label: '王昭君', + value: 'lisa', + } + ]} + /> @@ -133,10 +128,17 @@ export const Applications: FC> = () => { maxWidth: 200, width: '100%', }} - > - - - + options={[ + { + label: '优秀', + value: 'good', + }, + { + label: '普通', + value: 'normal', + }, + ]} + /> diff --git a/src/pages/list/search/articles/index.tsx b/src/pages/list/search/articles/index.tsx index e11cef07..c003b853 100644 --- a/src/pages/list/search/articles/index.tsx +++ b/src/pages/list/search/articles/index.tsx @@ -2,15 +2,16 @@ import { LikeOutlined, LoadingOutlined, MessageOutlined, StarOutlined } from '@a import { useRequest } from '@umijs/max'; import { Button, Card, Col, Form, List, Row, Select, Tag } from 'antd'; import type { FC } from 'react'; -import React from 'react'; +import React, { useMemo } from 'react'; import ArticleListContent from './components/ArticleListContent'; import StandardFormRow from './components/StandardFormRow'; import TagSelect from './components/TagSelect'; import type { ListItemDataType } from './data.d'; import { queryFakeList } from './service'; import useStyles from './style.style'; +import { categoryOptions } from '../../mock'; +import { DefaultOptionType } from 'antd/es/select'; -const { Option } = Select; const FormItem = Form.Item; const pageSize = 5; @@ -115,6 +116,11 @@ const Articles: FC = () => { ); + const ownerOptions = useMemo(() => owners.map(item => ({ + label: item.name, + value: item.id, + })), [owners]); + return ( <> @@ -129,30 +135,20 @@ const Articles: FC = () => { - 类目一 - 类目二 - 类目三 - 类目四 - 类目五 - 类目六 - 类目七 - 类目八 - 类目九 - 类目十 - 类目十一 - 类目十二 + {categoryOptions.map((category) => ( + {category.label} + ))} - + - - + - - + + options={[ + { + label: '王昭君', + value: 'lisa', + } + ]} + /> @@ -141,10 +136,17 @@ const Projects: FC = () => { maxWidth: 200, width: '100%', }} - > - - - + options={[ + { + label: '优秀', + value: 'good', + }, + { + label: '普通', + value: 'normal', + } + ]} + />