File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ export interface NumberDictDataType extends DictDataType {
24
24
value : number
25
25
}
26
26
27
+ export interface StringDictDataType extends DictDataType {
28
+ value : string
29
+ }
30
+
27
31
export const getDictOptions = ( dictType : string ) => {
28
32
return dictStore . getDictByType ( dictType ) || [ ]
29
33
}
@@ -44,8 +48,11 @@ export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
44
48
}
45
49
46
50
export const getStrDictOptions = ( dictType : string ) => {
47
- const dictOption : DictDataType [ ] = [ ]
51
+ // 获得通用的 DictDataType 列表
48
52
const dictOptions : DictDataType [ ] = getDictOptions ( dictType )
53
+ // 转换成 string 类型的 StringDictDataType 类型
54
+ // why 需要特殊转换:避免 IDEA 在 v-for="dict in getStrDictOptions(...)" 时,el-option 的 key 会告警
55
+ const dictOption : StringDictDataType [ ] = [ ]
49
56
dictOptions . forEach ( ( dict : DictDataType ) => {
50
57
dictOption . push ( {
51
58
...dict ,
You can’t perform that action at this time.
0 commit comments