

Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
本页面介绍了如何处理接口返回的数据,特别是针对特定数值进行条件判断和转换的方法。示例中展示了根据数据的值来决定返回0还是100的过程,并提供了相应的JavaScript代码实现。


/**
* 对返回的数据做一些自定义处理
* 返回数据文档:https://www.yuque.com/yida/support/xgg4ps
* data: 返回的数据
* extraInfo: { meta: [], cardParams: {} },meta 代表数据元信息,cardParams 代表卡片参数信息
*/
function afterFetch(data, extraInfo) {
data.forEach(item => {
// 判断数值是否大于 0
if (item['field_kr1zcs45'] > 0) {
// 大于 0 的话赋值为 100
item['field_kr1zcs45'] = 100;
} else {
// 否则等于 0
item['field_kr1zcs45'] = 0;
}
});
return data;
}
此页面对您有帮助吗?