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