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粉1229324662024-04-04 18:29:10
I found the answer:
Vue.delete(this.query_filters.target_filters, id);
(Source: Vue.js 2: Remove properties from data object)