VUE二级联动,改变一级下拉框,清空二级下拉框
在清空二级下拉框时,直接使用this.formData.xxx = '' 会出现清空失败的问题。
使用this.$set(this.formData, 'xxx', '')解决
<el-form-item label="所属地市" prop="blongId1"> <el-select v-model="bmixForm.blongId1" placeholder="请选择所属地市" style="width: 300px" @change="getAreaList2"> <el-option v-for="(item, index) in blongId1List" :key="index" :label="item.NAME" :value="item.ID"></el-option> </el-select> </el-form-item> <el-form-item label="所属分区" prop="blongId2"> <el-select v-model="bmixForm.blongId2" placeholder="请选择所属分区" style="width: 300px"> <el-option v-for="(item, index) in bmixFormBlongId2List" :key="index" :label="item.NAME" :value="item.ID"></el-option> </el-select> </el-form-item>
getAreaList2(){ this.$set(this.bmixForm, 'blongId2', '') this.getAreaListByCity2(this.bmixForm.blongId1); }