About the method of iview select binding two values

Because v-model can only bind one value

So we can have the following ideas

 1. Splicing value

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

2. Binding index

Instead of binding a specific value, bind the index value: value="index", you can get options[index].value like this when getting the value.

3. Binding events

 <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;
}}

Guess you like

Origin blog.csdn.net/weixin_43465508/article/details/132694181