首先增加全选按钮:

<el-select filterable v-model="cityIds" multiple  collapse-tags   placeholder="请选择"  @change="getCityNames" >
           <el-option label="----全选----" value="000"></el-option>
          <el-option v-for="item in options.cityList" 
                        :key="item.area_id" 
                        :label="item.area_name"
                        :value="item.area_id">
           </el-option>
</el-select>

通过watch事件进行,全选互斥:

watch: {
            cityIds:function(value){
                let valength = value.length;
                if(valength > 1 && value[valength - 1] == "000"){
                    this.cityIds = ["000"];
                }else if(valength == 2 && value[0] == "000"){
                    this.cityIds.shift();
                }
            }
        },

最后再通过change事件进行数据处理,ok

 

相关文章:

  • 2021-04-19
  • 2021-07-18
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-11-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2021-11-23
  • 2021-05-31
  • 2021-09-13
  • 2022-12-23
相关资源
相似解决方案