select下拉框中某一项不可选置灰
一,
html
<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>
二,
script
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:{
} }
三,
css
.statusbtn { color: #d6caca; cursor: not-allowed; /*这个在button上面才管用,是一个禁用的小标识*/ }
所有评论(0)