antdv 下拉框的 blur() 方法使用
代码
<template>
<div>
<a-select v-model:value="num" ref="selectVal" @change="onSelect">
<a-select-option value="">--请选择--</a-select-option>
<a-select-option value="1">1</a-select-option>
<a-select-option value="2">2</a-select-option>
</a-select>
</div>
</template>
<script>
import {
ref,
} from 'vue';
export default defineComponent({
setup() {
const num = ref();
const selectVal = ref();
const onSelect = ()=>{
selectVal.value.blur();
}
return {
num,
selectVal,
onSelect
}
}
});
</script>
<style>
</style>