Reputation: 367
I made a codepent - example: https://codepen.io/rasenkantenstein/pen/qBdZepM
The user should choose a country and eventually only select the cities belonging to a country. However, there's an array behind the data of the people. How can I tell Vue(tify) to alter only those items from the currently edited row?
changeCity(index, country) {
//How can I filter the cities here for each person?
let result = this.cities.filter(city => {
return city.country == country
})
console.log(result)
//this works on all fields... ? --> this.cities = result
}
Upvotes: 1
Views: 1849
Reputation: 771
You should filter the cities based on the person country, inside your v-select, like this:
:items="cities.filter(c => c.country === person.country)"
Upvotes: 4