我有一个带有 ref="form" 的表单和表单中的一些元素,如下所示:
<el-form :model="form" :rules="rules" ref="form" label-width="120px">
<el-form-item label="reason" prop="reason">
<el-select
v-model="form.reason"
//ref="reason" try use this but doesnt work
filterable
remote
reserve-keyword
placeholder="test"
:remote-method="remoteMethod"
:loading="loading"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.name"
:value="item.value"
@click="check_exist_variables(item)"
></el-option>
</el-select></el-form-item>
</el-form>
我尝试将 ref 设置为 item 以在单击后更改焦点组件:
check_exist_variables: function (item) {
//...
this.$refs.form.reason.blur();
// or
this.$refs.reason.blur();
},
点击 el-option 后,继续关注 el-option。我做错了什么?
更新:this.$refs.select_comment.focus(); 是工作,但模糊仍然没有