rasenkantenstein
rasenkantenstein

Reputation: 367

Vuetify: Dependent v-select based on selection

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

Answers (1)

rodurico
rodurico

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

Related Questions