P粉1514660812023-07-25 20:42:31
在映射数组时,只需使用answerProps接口。
interface answerProps { state: string; answer: string; } const results: Array<string> = []; !isEmpty(answers) && answers.map((item: answerProps) => results.push(`${item.state} : ${item.answer}`));