{
id: 1,
name: "Москва",
children: [
{
id:2,
name: 'Академический'
children: [
{
id:3,
name: 'ул. Янгеля'
}
....
]
}
....
]
}
const filter = (arr, str) => (arr || [])
.map(n => ({ ...n, children: filter(n.children, str) }))
.filter(n => n.name.includes(str) || n.children.length);
computed: {
filteredItems() {
return filter(this.items, this.search);
},
},