UNPKG

press-next

Version:

Vue3 组件库,支持 Composition API

33 lines (27 loc) 739 B
export function getListViewScheList(scheList: any[]) { if (!scheList?.length) { return []; } let result: Array<{ sche?: any; roundInfo?: any; }> = []; // 构造符合组件需求的数据 scheList.forEach((elem) => { elem?.forEach((item: any) => { item.battleList.forEach((battle: any) => { result.push({ sche: battle, roundInfo: item.roundInfo, }); }); }); }); result = result .filter(elem => !!elem); return result; } export const filterScheByRoundName = (list: any[], curRoundFilter?: string) => list?.filter((elem) => { const { round_name: tag } = elem.roundInfo || {}; return tag === curRoundFilter || curRoundFilter === '全部'; });