(轉)兩個select使用同樣的數據源,兩個選擇結果互斥

原文:https://segmentfault.com/q/1010000039415642

<template>
  <el-select v-model="value1" placeholder="請選擇1">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :disabled="item.value === value2"
      :value="item.value">
    </el-option>
  </el-select>
  <el-select v-model="value2" placeholder="請選擇2">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :disabled="item.value === value1"
      :value="item.value">
    </el-option>
  </el-select>
</template>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章