el-select 下拉框某一项设置为不可选

<div class="sale">
      <select @change="GetCountyData()">
           <option>请选择</option>
           <option v-for="(item,index) in data" :disabled="item.is_true==1?true:false" :class="{statusbtn:item.is_true==1}">{{item.is_true}}</option>
      </select>
</div>

<style>
.statusbtn {
     color: #d6caca;
     cursor: not-allowed; /*这个在button上面才管用,是一个禁用的小标识*/
}
</style
export default {
        name: 'app',
        data() {
            return {
               "data": [{
                  "is_true": "0",
                  "region_id": "12",
                  "region_name": "南昌市",
                },
               {
                 "is_true": "1",
                 "region_id": "13",
                 "region_name": "景德镇市",
               },
               {
                 "is_true": "0",
                 "region_id": "14",
                 "region_name": "萍乡市",
               },
               {
                 "is_true": "1",
                 "region_id": "15",
                 "region_name": "九江市",
               },
               {
                 "is_true": "0",
                 "region_id": "16",
                 "region_name": "新余市",
               },
               {
                 "is_true": "0",
                 "region_id": "17",
                 "region_name": "鹰潭市",
               }
              ]

            }
        },
        props: [],
        mounted() {
        },
        methods:{
       
        }
}

转载:https://www.cnblogs.com/liujiajiablog/p/9797681.html

 

posted @ 2023-05-10 17:20  挽你手  阅读(805)  评论(0编辑  收藏  举报