乐趣区

关于vue.js:vue-elselect

el-select 可多选可单选 ,抉择全副后不能抉择其余,具体参照如下代码:

<el-select size="middle" clearable v-model="form.ground"  @change="handlePlat" placeholder="请抉择小组" filterable multiple  style="width: 400px;">
  <el-option label="全副" value="全副"></el-option>
  <el-option v-for="(item, index) in groundList" :key="index" :label="item.name" :value="String(item.id)" :disabled="item.disabled"></el-option>
</el-select>

handlePlat(){if (this.form.ground.indexOf("全副") == "-1") {this.groundList.map((res) => {res.disabled = false;});
  } else {this.groundList.map((res) => {res.disabled = true;});
    this.form.ground = ["全副"];
  }
}
退出移动版