What is the process to create an allocation file named createAllocation.txt?
- 内容介绍
- 文章标签
- 相关推荐
本文共计146个文字,预计阅读时间需要1分钟。
javascriptcreateAllocation.txt function createAllocation(data) { if (A.isArray(data.input)) { let profile={}, P, inputs=data.input; const def={ id: '', name: 'noname', type: 'text', value: '', placeholder: '' }; O.keys(data).forEach(item=> { if (item==='input') { inputs.forEach(input=> { let inputDef=Object.assign({}, def, input); profile[inputDef.id]=inputDef; }); } else { profile[item]=data[item]; } }); return profile; }}
function createAllocation(data){ if (A.isArray(data.input)) { let profile = {}, P, inputs = data.input const def = { id: '', name: 'noname', type: 'text', value: '', placehold: '' } O.keys(data).forEach( item => { if (item!='input') profile[item] = data[item] }) return inputs.map( input => { P = _.extend( def, (input.props||input)) P.attr = { title: profile.title||P.title||'', desc: profile.desc||P.desc||'', className: (profile.itemClass||P.itemClass) ? 'inputItem '+(profile.itemClass||P.itemClass) : 'inputItem' } if (P.union){ P.target = { id: P.id, name: P.name, type: P.type, } } }) } return data }
本文共计146个文字,预计阅读时间需要1分钟。
javascriptcreateAllocation.txt function createAllocation(data) { if (A.isArray(data.input)) { let profile={}, P, inputs=data.input; const def={ id: '', name: 'noname', type: 'text', value: '', placeholder: '' }; O.keys(data).forEach(item=> { if (item==='input') { inputs.forEach(input=> { let inputDef=Object.assign({}, def, input); profile[inputDef.id]=inputDef; }); } else { profile[item]=data[item]; } }); return profile; }}
function createAllocation(data){ if (A.isArray(data.input)) { let profile = {}, P, inputs = data.input const def = { id: '', name: 'noname', type: 'text', value: '', placehold: '' } O.keys(data).forEach( item => { if (item!='input') profile[item] = data[item] }) return inputs.map( input => { P = _.extend( def, (input.props||input)) P.attr = { title: profile.title||P.title||'', desc: profile.desc||P.desc||'', className: (profile.itemClass||P.itemClass) ? 'inputItem '+(profile.itemClass||P.itemClass) : 'inputItem' } if (P.union){ P.target = { id: P.id, name: P.name, type: P.type, } } }) } return data }

