编辑的时候,这个下拉列表有个默认回显的数据,导致在进行其他项选择的时候,不能立即更新选框的值,查找原因很久,才找到解决方法,费了不少时间,特此记录下
<el-select
v-if="paperType == 1"
v-model="form.questionTh"
placeholder="请选择题号"
style="margin-bottom:10px;margin-left:5px;"
@change="changeQuestionThSelect"
>
<el-option
v-for="dict in structInfo"
:key="dict.id"
:label="dict.name"
:value="dict.id"
:disabled="dict.disabled"
/>
</el-select>
//选择序号
changeQuestionThSelect(value) {
let name = ''
this.structInfo.forEach(item => {
if (item.id == value) {
name = item.name
}
})
this.form.structName = name
//回显后选择强制刷新
this.$forceUpdate()
},
强制刷新后,数据切换就能显示当前选中的值了,其他的下拉框,没问题,就这个出问题了!具体的原因希望有懂得大佬能指点下