场景
报修范围取值不同时 ,区域有时需要禁用
代码
<el-form-item label="报修范围" prop="applicationRange" >
<el-select v-model="addInfo.applicationRange" placeholder="请选择报修范围" style="width: 200px" @change="inputToDisabled" >
<el-option v-for="item in applicationRangeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="区域" prop="areaCodeAdd">
<el-select v-model="addInfo.areaCodeAdd" placeholder="请选择区域" v-on:change="getBuildListAdd" style="width: 220px" :disabled="isAble" >
<el-option
v-for="item in areaListAdd"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
methods:{
inputToDisabled (){
if (this.addInfo.applicationRange === '1002') {
this.isAble = true; // 注意true是不可用
} else{
this.isAble = false; //可用
}
},
}