自学内容网 自学内容网

处理成二维数组对象

const objects = []
let checkboxvalue = [{ name: '名字1' }, { name: '名字2' }]
let data = [{ value: '值1', id: 'id1' }, { value: '值2', id: 'id2' }]

let arr = []
checkboxvalue.map((item, index) => {
    // data[index].name = item.name
    arr.unshift({ contractName: item.name, list: data[index] })
})
console.log(arr);

[
        {

                contractName:'xxxxxx',

                 list:[  ]

        },

        {

                contractName:'xxxxxx',

                 list:[  ]

        },

]

二维数组对象制成表格

this.regularArr2 = ['', ...this.unitevertical1].map((v1, i1) =>
     ['用人单位类型', ...this.uniterow1].map((v2, i2) => {
           if (!i1 && !i2) return '用人单位类型'
               if (!i1) return v2
               if (!i2) return v1
     })
)


原文地址:https://blog.csdn.net/szzlh123456789/article/details/140303031

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!