1 采用计时器
<el-select v-model="scope.row.targetId"
:disabled="disabled"
clearable
placeholder="请选择"
filterable
automatic-dropdown
@blur="blurSelect">
// el-select失去焦点必填校验
blurSelect(e) {
setTimeout(()=> {
if(!e.target.value) {
this.$message.warning('请选择必填项!')
}
},1000)
},
2 采用focus来获取blur
<el-select
v-model="scope.row.targetId"
ref="fuzzySearch"
multiple
placeholder="请选择"
filterable
automatic-dropdown
@focus="focusSelectValue"
>
<el-option v-for="(item,index) in fileType"
:key="index"
:label="item.name"
:value="item.targetId" />
</el-select>
focusSelectValue() {
console.log(this.$refs.fuzzySearch);
this.$refs.fuzzySearch.$refs.input.blur = () => {
console.log(this.$refs.fuzzySearch.$refs.input.value);
};
},
3.使用这个事件即可
@blur.native.capture即可
————————————————
版权声明:本文为CSDN博主「山谷里的杂货铺」的原创文章,遵循CC 4.0 BY原文链接:https://blog.csdn.net/weixin_58528200/article/details/121671550@TOC