const dictData = { signalType: [ { key: '0', value: '无' }, { key: '1', value: 'LAN' }, { key: '2', value: '4G' } ] }; function getDictionary(type, key) { // 验证输入参数 if (!type || !dictData[type]) { return ''; } const item = dictData[type].find(item => item.key === key); if (item) { return item.value; } else { return ''; } } export default getDictionary;