在post请求体中可能是一个后端未定义的对象,要取得其中的key对应的value。
先定义一个任意数量属性的interface:
interface x {
[propName: string]: any;
}
然后接受请求体数据:
@requestBody(
{
content: {
'application/json': {
},
},
}) a: x
取得key对应的value:
console.log(a["name"] + a['tel']);