perf: 【ANTD】优化一些 todo 提到的问题

This commit is contained in:
puhui999
2025-05-20 15:08:54 +08:00
parent 074eb0e83d
commit 98a742895d
20 changed files with 87 additions and 101 deletions

View File

@@ -14,11 +14,11 @@ import { useDictStore } from '#/store';
type ColorType = 'error' | 'info' | 'success' | 'warning';
export interface DictDataType {
dictType: string;
dictType?: string;
label: string;
value: boolean | number | string;
colorType: ColorType;
cssClass: string;
colorType?: ColorType;
cssClass?: string;
}
export interface NumberDictDataType extends DictDataType {
@@ -62,11 +62,10 @@ function getDictObj(dictType: string, value: any) {
* @param valueType 字典值类型,默认 string 类型
* @returns 字典数组
*/
// TODO @puhui999貌似可以定义一个类型不使用 any[]
function getDictOptions(
dictType: string,
valueType: 'boolean' | 'number' | 'string' = 'string',
): any[] {
): DictDataType[] {
const dictStore = useDictStore();
const dictOpts = dictStore.getDictOptions(dictType);
const dictOptions: DefaultOptionType = [];