微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -0,0 +1,21 @@
/**
* 渲染辅助工具函数
* 纯函数,无 wx.* 依赖
*/
/**
* 从对象中提取指定字段,缺失字段填充 null
* @param item 数据对象
* @param fieldList 需要的字段名数组
* @returns 仅包含指定字段的新对象
*/
export function getRequiredFields(
item: Record<string, any>,
fieldList: string[]
): Record<string, any> {
const result: Record<string, any> = {}
for (const field of fieldList) {
result[field] = field in item ? item[field] : null
}
return result
}