UNPKG

vue-django

Version:

个人实验项目, 本框架的目标是借鉴并超越django admin的自动化思想, 实现UI前端的极简快速定制开发

33 lines (31 loc) 849 B
/** * Created by denishuang on 2019/8/25. */ export default function (items, templates, normalize) { // console.log(templates) // if(!(templates instanceof Array)) { // templates = [templates] // } if (items === 'all' && templates) { items = Object.keys(templates) } return items.map((a, i) => { let d = {} if (typeof a === 'string' || a instanceof String) { Object.assign(d, templates[a]) d.name = a } else if (a instanceof Array) { d = a } else { // templates.forEach(t => { // Object.assign(d, t[a.name]) // }) Object.assign(d, templates[a.name], a) // console.log(d) } if (normalize) { d = normalize(d, i) } return d }) }