iview select 2つの値をバインドする方法について

v-model は 1 つの値しかバインドできないため、

したがって、次のようなアイデアが考えられます

 1. スプライシング値

:value="item.value+item.label"
// 或者  value.split('/')[0]取值
:value="item.value+'/'+item.label"

2. バインディングインデックス

特定の値をバインドする代わりに、インデックス値をバインドします: value="index"。値を取得するときに、次のように options[index].value を取得できます。

3. バインディングイベント

 <Select v-model="project.id" filterable multiple label-in-value="true"
@on-change="onChangeConstruction" >
                <Option v-for="item in cityList" :value="item.id" :label="item.name" :key="item.id">{
   
   { item.label }}</Option>
</Select>


onChangeConstruction:function(obj){
if(obj.label)
{
this.project.construction=obj.label;
}}

おすすめ

転載: blog.csdn.net/weixin_43465508/article/details/132694181