Angular 将一维列表转换为三维列表

Angular 将一维列表转换为三维列表,angular,typescript,Angular,Typescript,我有一个一维列表。我必须把它转换成三维列表。我怎么办 这是我的名单 this.galleryImages = [ { small: 'https://res.cloudinary.com/tasit-com/image/upload/c_thumb,w_640,h_480,e_sharpen:120/ccd97b3bb468f62162e1ce7557f25a06.jpg', medium: 'https:

我有一个一维列表。我必须把它转换成三维列表。我怎么办

这是我的名单

 this.galleryImages = [
            {
                small: 'https://res.cloudinary.com/tasit-com/image/upload/c_thumb,w_640,h_480,e_sharpen:120/ccd97b3bb468f62162e1ce7557f25a06.jpg',
                medium: 'https://res.cloudinary.com/tasit-com/image/upload/c_thumb,w_640,h_480,e_sharpen:120/ccd97b3bb468f62162e1ce7557f25a06.jpg',
                big: 'https://imganuncios.mitula.net/renault_clio_2017_motorin_1_94_vade_orani_40_pe_i_n_48ay_taksi_t_duzgun_ti_caret_bunyesi_nde_3720113557242259227.jpg',

            },
            {
                small: 'https://imganuncios.mitula.net/renault_clio_2017_motorin_1_94_vade_orani_40_pe_i_n_48ay_taksi_t_duzgun_ti_caret_bunyesi_nde_3720113557242259227.jpg',
                medium: 'https://imganuncios.mitula.net/renault_clio_2017_motorin_1_94_vade_orani_40_pe_i_n_48ay_taksi_t_duzgun_ti_caret_bunyesi_nde_3720113557242259227.jpg',
                big: 'https://imganuncios.mitula.net/renault_clio_2017_motorin_1_94_vade_orani_40_pe_i_n_48ay_taksi_t_duzgun_ti_caret_bunyesi_nde_3720113557242259227.jpg'
            },
            {

                small: 'https://www.ihaleden.com/uploads/media/5c6f93d30a4a4.png',
                medium: 'https://www.ihaleden.com/uploads/media/5c6f93d30a4a4.png',
                big: 'https://www.ihaleden.com/uploads/media/5c6f93d30a4a4.png'
            }
        ]


我的一维列表是selectedFilesList。我想将此列表转换为三维列表,并与其他列表相等。

如果我正确理解您的问题,使用地图功能可以帮助您完成以下操作:

const selectedFilesList = ['a', 'b', 'c'];

this.galleryImages = selectedFilesList.map((selectedFile) => {
    return {
        small: selectedFile,
        medium: selectedFile,
        big: selectedFile
    }
});

希望这有帮助

你说的三维是什么意思?你能编辑这个问题以提供所需的结构吗?就这样?。现在你能帮我吗Harun先生?我的意思是你想把数组转换成这样的东西。galleryImages['small'][0]或者这个。galleryImages['medium'][2]而不是这个。galleryImages[0]['small']或者这个。galleryImages[2]['medium']?我有一个1d数组。我想把它转换成3D数组,每一个项目都要重复3次,请考虑编辑这个问题中的代码来构成一个。这应包括输入和所需输出。现在,问题中只有类似于输出的东西,以及注释中输入的草图。看起来您需要inArr.mapx=>{small:x,medium:x,large:x},但是如果没有实际的示例代码,我们无法确定。祝你好运