我有一個嵌套對象,其中包含幾個鍵,這些鍵還包括標題和子項。Children 是也具有標題和子鍵的對象數組。(它們看起來像一棵樹)如何搜索和替換標題值的一個單詞或一部分?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標題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: [{...}]}
搜索并替換標題鍵嵌套對象vue js上的字符串
長風秋雁
2023-09-21 16:51:56