_self.accuserList = res.data.data.accuser.map((arr)=>{
if (arr.userType == 1){
arr.userType = "自然人"
}if (arr.userType == 2){
arr.userType = "法人公司"
}if (arr.userType == 3){
arr.userType = "司法组织"
} })
可写成:
_self.accuserList = res.data.data.accuser.map((arr)=>{
const type = ['', '自然人', '法人公司', '司法组织']
arr.userType = type[arr.userType]
})
return arr
})
数据解析采用数组映射一一对应,