繁体   English   中英

Vuetify:基于选择的依赖 v-select

[英]Vuetify: Dependent v-select based on selection

我做了一个codepent - 例如: https ://codepen.io/rasenkantenstein/pen/qBdZepM

用户应该选择一个国家,最终只选择属于一个国家的城市。 然而,人的数据背后有一个数组。 如何告诉 Vue(tify) 仅更改当前编辑行中的那些项目?

    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
   }

您应该在 v-select 中根据个人国家/地区过滤城市,如下所示:

:items="cities.filter(c => c.country === person.country)"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM