[el-select] simple usage of multiple selection

Even if element has been used for a long time, there will still be new things that have not been used

The multi-choice of el-select is very similar to the el-date-picker with a range of date components. They are all bound arrays, and then assign values ​​​​to the required fields

insert image description here
Just add the multiple attribute, collapse-tags to see if you need it

At this time, v-model is bound to an array

<el-form-item label="发票类型">
   <el-select v-model="gvType" @change="gvtypeChange" multiple clearable :placeholder="$t('placeholderName.select')">
                              <el-option
                                v-for="item in voucher_type"
                                :key="item.dictCode"
                                :value="item.dictValue"
                                :label="item.dictLabel"
                              ></el-option>
                            </el-select>
                          </el-form-item>
data(){
    
    
return{
    
    
      gvType: [], //多选

}
}

Assign values ​​to the fields you need in the change event, and convert the array to a string is the format required by the backend

   gvtypeChange() {
    
    
      this.queryParams.gvType = this.gvType.toString()
    },

insert image description here

Guess you like

Origin blog.csdn.net/weixin_49668076/article/details/130646122