UNPKG

antd-mobile

Version:

<img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*hjjDS5Yy-ooAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />

23 lines (20 loc) 523 B
export function generateCascadePickerColumns(value, options, depth, subOptionsRecord) { const columns = []; columns.push(options.map(option => ({ label: option.label, value: option.value }))); for (let i = 0; i < depth - 1; i++) { const x = value[i]; const subOptions = subOptionsRecord[x]; if (!subOptions) { columns.push([]); } else { columns.push(subOptions.map(option => ({ label: option.label, value: option.value }))); } } return columns; }