Skip to content

Commit 9307d08

Browse files
author
奇淼(piexlmax
committed
增加字典方法 showDictLabel(字典,字典value)返回字典 label
1 parent 2cdcd98 commit 9307d08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

web/src/utils/dictionary.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@ export const getDict = async(type) => {
55
await dictionaryStore.getDictionary(type)
66
return dictionaryStore.dictionaryMap[type]
77
}
8+
9+
// 字典文字展示方法
10+
export const showDictLabel = (dict, code) => {
11+
if (!dict) {
12+
return ''
13+
}
14+
const dictMap = {}
15+
dict.forEach(item => {
16+
dictMap[item.value] = item.label
17+
})
18+
return dictMap[code]
19+
}

0 commit comments

Comments
 (0)