🐛 修复 IDEA 在 v-for="dict in getIntDictOptions(...)"
时,el-option
的 key
会告警的问题
This commit is contained in:
parent
f372fc0cdc
commit
255708beec
@ -20,13 +20,20 @@ export interface DictDataType {
|
|||||||
cssClass: string
|
cssClass: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface NumberDictDataType extends DictDataType {
|
||||||
|
value: number
|
||||||
|
}
|
||||||
|
|
||||||
export const getDictOptions = (dictType: string) => {
|
export const getDictOptions = (dictType: string) => {
|
||||||
return dictStore.getDictByType(dictType) || []
|
return dictStore.getDictByType(dictType) || []
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getIntDictOptions = (dictType: string): DictDataType[] => {
|
export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
|
||||||
const dictOption: DictDataType[] = []
|
// 获得通用的 DictDataType 列表
|
||||||
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
||||||
|
// 转换成 number 类型的 NumberDictDataType 类型
|
||||||
|
// why 需要特殊转换:避免 IDEA 在 v-for="dict in getIntDictOptions(...)" 时,el-option 的 key 会告警
|
||||||
|
const dictOption: NumberDictDataType[] = []
|
||||||
dictOptions.forEach((dict: DictDataType) => {
|
dictOptions.forEach((dict: DictDataType) => {
|
||||||
dictOption.push({
|
dictOption.push({
|
||||||
...dict,
|
...dict,
|
||||||
|
Loading…
Reference in New Issue
Block a user