4 回复
// 如果数据不多的话,考虑下下面这种写法吧
const grade = 1 || '2'
const gradeTxtList = ['无','无','白金','砖石']
const gradeTxt = gradeTxtList[+grade||0]
// const gradeTxt = !isNaN(+grade) ? gradeTxtList[+grade||0] :'default value'
// const gradeTxt = ['无','无','白金','砖石'][+grade||0]
// const getGradeTxt = grade => ['无','无','白金','砖石'][+grade||0];