我有一個(gè)嵌套對象,其中包含幾個(gè)鍵,這些鍵還包括標(biāo)題和子項(xiàng)。Children 是也具有標(biāo)題和子鍵的對象數(shù)組。(它們看起來像一棵樹)如何搜索和替換標(biāo)題值的一個(gè)單詞或一部分?const object = { id: 'uuid', title: 'hello You', type: number, visibility: true, children: [ { id: 'uuid', title: 'You don't have any comments...', type: number, visibility: true, children: [{...}, {...}, ...], key1: {...}, key2: [{...}] }, { id: 'uuid', title: 'You your problem is not with json...', type: number, visibility: true, children: [{...}, {...}, ...], key1: {...}, key2: [{...}] } ], key1: {...}, key2: [{...}]}搜索you并替換world標(biāo)題output = { id: 'uuid', title: 'hello world', type: number, visibility: true, children: [ { id: 'uuid', title: 'world don't have any comments...', type: number, visibility: true, children: [{...}, {...}, ...], key1: {...}, key2: [{...}] }, { id: 'uuid', title: 'world your problem is not with json...', type: number, visibility: true, children: [{...}, {...}, ...], key1: {...}, key2: [{...}] } ], key1: {...}, key2: [{...}]}
搜索并替換標(biāo)題鍵嵌套對象vue js上的字符串
長風(fēng)秋雁
2023-09-21 16:51:56