我有一个嵌套的对象数组,我需要动态更改子数据的值
[
{
type: "root",
title: "FileManager",
isDirectory: true,
children: [
{
type: "folder",
title: "animals",
isDirectory: true,
children: [
{
type: "folder",
title: "cat",
isDirectory: true,
children: [
{
type: "folder",
title: "images",
isDirectory: true,
children: [
{
type: "file",
title: "cat001.jpg",
isDirectory: false,
}, {
type: "file",
title: "cat002.jpg",
isDirectory: false,
}
]
}
]
}
]
},
{
type : "folder",
title : 'Birds',
isDirectory : true,
children : []
}
]
}
]
这是我的主要对象数组,假设我想动态更改子对象的值。假设我想向图像数组中的子对象添加一个对象,因此图像数组的路径是 FileManager / Animals / cat / images 如何动态更改图像对象中子对象的值?
幕布斯6054654
相关分类