In my Vue.js components, I have a group of checkboxes that are sending data to the parent element. My goal is to monitor this data for changes and use it to filter information in an API call.
When certain checkboxes are selected, the data stored on the parent element looks like this:
https://i.sstatic.net/aCz9T.png
I aim to incorporate this data into an API request that would follow this format when the data changes:
this.axios.get('http://localhost:8000/api/v1/schools' +
for (feature in selectedFeatures) {
'?features[]=' + feature
}
).then((response) => {
this.$root.$emit('searchQuery', response.data);
});
Typically, using Vue's Watch functionality makes this task simple. However, due to the nested structure of my dynamic arrays, I am unsure how to achieve this.