我有定制的格式化程序来修改API的最终响应,如下所示.
getFormatedFilterTuplet(result, filter) {
return {
id: _get(result, _toPath(filter.idPath)),
value: filter.getValue
? filter.getValue(result)
: _get(result, _toPath(filter.valuePath || filter.idPath)),
};
}
格式化后的响应如下所示
[
{
"id": [
3
],
"value": "test1"
},
{
"id": [
1
],
"value": "test2"
}
]
我们如何更改现有的格式化程序或编写新的格式化程序以获得响应,如下所示
[
{
"id": 3,
"value": "test1"
},
{
"id": 1,
"value": "test2"
}
]