Having trouble removing deep objects
P粉283559033
P粉283559033 2024-04-03 21:48:14
0
1
382

My Vue component uses an object inside an object to display elements. When I click a button on the page, I want to delete one of the nested objects. It seems to be deleted, when I do console.log(this.query_filters.target_filters[id]) right after deleting the element, it shows that the object has been deleted (see first screenshot). However, the Vue tab still displays the element and my UI does not update to show that it has been removed (see second screenshot).

I am removing nested objects like this: Delete this.query_filters.target_filters[id];

I don't reset/add the object anywhere else (this only happens once when a certain button is clicked).

P粉283559033
P粉283559033

reply all(1)
P粉122932466

I found the answer:

Vue.delete(this.query_filters.target_filters, id);

(Source: Vue.js 2: Remove properties from data object)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template