关于vue.js:vue-elselect

56次阅读

共计 542 个字符,预计需要花费 2 分钟才能阅读完成。

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 = ["全副"];
  }
}

正文完
 0